]>
Commit | Line | Data |
---|---|---|
757b3ba5 ER |
1 | # |
2 | # Conditional build: | |
42a31ab3 | 3 | %bcond_without verbose # verbose build (V=1) |
757b3ba5 | 4 | |
b6a5d8d0 | 5 | # NOTE |
e540e830 | 6 | # - relase notes: https://developers.google.com/speed/pagespeed/module/release_notes |
757b3ba5 | 7 | # - http://code.google.com/p/modpagespeed/wiki/HowToBuild |
eb743e9a | 8 | # - http://wiki.mediatemple.net/w/(dv)_HOWTO:_Install_mod_pagespeed |
b6a5d8d0 | 9 | # TODO |
757b3ba5 | 10 | # - add unit tests running |
b6a5d8d0 ER |
11 | # - possible sysdeps (uses release tags) |
12 | # "serf_src": "http://serf.googlecode.com/svn/tags/0.3.1", | |
b6a5d8d0 ER |
13 | # "gflags_root": "http://google-gflags.googlecode.com/svn/tags/gflags-1.3/src", |
14 | # "google_sparsehash_root": "http://google-sparsehash.googlecode.com/svn/tags/sparsehash-1.8.1/src", | |
b74b29a5 | 15 | # protobuf_lite |
24f1647c | 16 | |
08710a2f | 17 | %define mod_name pagespeed |
cad452c8 | 18 | %define apxs %{_sbindir}/apxs |
08710a2f ER |
19 | Summary: Apache module for rewriting web pages to reduce latency and bandwidth |
20 | Name: apache-mod_%{mod_name} | |
ffebf8bc ER |
21 | # beta: 1.9.32.2-beta |
22 | # stable: 1.8.31.5 | |
23 | Version: 1.8.31.5 | |
99c7dfcb | 24 | Release: 0.7 |
08710a2f ER |
25 | License: Apache v2.0 |
26 | Group: Networking/Daemons/HTTP | |
4623c72a | 27 | Source0: modpagespeed-%{version}.tar.xz |
99c7dfcb | 28 | # Source0-md5: 0ec574731370f3da33fd16f536174050 |
b74b29a5 | 29 | Source1: get-source.sh |
5a3e561c | 30 | Source2: gclient.conf |
42a31ab3 | 31 | Patch0: system-libs.patch |
1a9213c5 | 32 | Patch2: bug-632.patch |
cad452c8 | 33 | Patch4: no-dev-stdout.patch |
59548b66 | 34 | URL: https://developers.google.com/speed/pagespeed/module |
08710a2f ER |
35 | BuildRequires: %{apxs} |
36 | BuildRequires: apache-devel >= 2.2 | |
ffebf8bc | 37 | BuildRequires: bash |
42a31ab3 | 38 | BuildRequires: glib2-devel |
3f27b998 | 39 | BuildRequires: gperf |
99c7dfcb | 40 | BuildRequires: libicu-devel |
42a31ab3 | 41 | BuildRequires: libselinux-devel |
b74b29a5 | 42 | BuildRequires: libstdc++-devel >= 5:4.1 |
4623c72a | 43 | BuildRequires: opencv-devel >= 2.3.1 |
42a31ab3 | 44 | BuildRequires: openssl-devel |
3f27b998 | 45 | BuildRequires: pkgconfig |
757b3ba5 | 46 | BuildRequires: python-devel >= 1:2.6 |
4623c72a ER |
47 | # This version of gyp is new enough that it knows to use make for Linux 3.x |
48 | # and FreeBSD, but old enough that 'type': 'settings' works and | |
49 | # LINKER_SUPPORTS_ICF hasn't been removed yet. | |
3fbdacfc | 50 | BuildRequires: python-gyp >= 0.1-0.svn1602.1 |
08710a2f | 51 | BuildRequires: rpmbuild(macros) >= 1.268 |
4623c72a | 52 | BuildRequires: tar >= 1:1.22 |
2ddcd200 | 53 | BuildRequires: util-linux |
4623c72a | 54 | BuildRequires: xz |
42a31ab3 | 55 | BuildRequires: zlib-devel |
08710a2f | 56 | Requires: apache(modules-api) = %apache_modules_api |
e5171f2e | 57 | Requires: apache-mod_authz_host |
3f27b998 | 58 | Requires: apache-mod_headers |
b6a5d8d0 | 59 | Suggests: apache-mod_deflate |
08710a2f ER |
60 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
61 | ||
62 | %define _pkglibdir %(%{apxs} -q LIBEXECDIR 2>/dev/null) | |
06daee42 ER |
63 | %define _pkgrootdir %(%{apxs} -q SYSCONFDIR 2>/dev/null) |
64 | %define _sysconfdir %{_pkgrootdir}/conf.d | |
65 | %define htdocsdir %(%{apxs} -q htdocsdir 2>/dev/null) | |
66 | %define cachedir %(%{apxs} -q proxycachedir 2>/dev/null)/mod_%{mod_name} | |
08710a2f ER |
67 | |
68 | %description | |
69 | mod_pagespeed automates the application of those rules in an Apache | |
70 | server. HTML, CSS, JavaScript, and images are changed dynamically | |
71 | during the web serving process, so that the best practices recommended | |
72 | by Page Speed can be used without having to change the way the web | |
73 | site is maintained. | |
74 | ||
75 | %prep | |
5bdfa704 ER |
76 | %setup -q -n modpagespeed-%{version} |
77 | %patch0 -p2 | |
ce5a7d18 | 78 | %patch2 -p1 |
9c41f6b1 | 79 | %patch4 -p1 |
08710a2f | 80 | |
99c7dfcb ER |
81 | rm -r third_party/icu/source |
82 | rm -r third_party/icu/genfiles | |
83 | install -d third_party/icu/source/{common,i18n} | |
84 | ln -s %{_includedir}/unicode third_party/icu/source/i18n/unicode | |
85 | ln -s %{_includedir}/unicode third_party/icu/source/common/unicode | |
86 | ||
08710a2f | 87 | %build |
eb743e9a | 88 | # re-gen makefiles |
e62ba6cb ER |
89 | CC="%{__cc}" \ |
90 | CXX="%{__cxx}" \ | |
5bdfa704 ER |
91 | %{__python} build/gyp_chromium \ |
92 | --format=make \ | |
93 | --depth=. \ | |
94 | build/all.gyp \ | |
42a31ab3 ER |
95 | -Duse_openssl=1 \ |
96 | -Duse_system_apache_dev=1 \ | |
99c7dfcb | 97 | -Duse_system_icu=1 \ |
42a31ab3 ER |
98 | -Duse_system_libjpeg=1 \ |
99 | -Duse_system_libpng=1 \ | |
100 | -Duse_system_opencv=1 \ | |
99c7dfcb | 101 | -Duse_system_openssl=1 \ |
42a31ab3 | 102 | -Duse_system_zlib=1 \ |
b2f50394 ER |
103 | -Dsystem_include_path_apr=%{_includedir}/apr \ |
104 | -Dsystem_include_path_aprutil=%{_includedir}/apr-util \ | |
105 | -Dsystem_include_path_httpd=%{_includedir}/apache \ | |
42a31ab3 ER |
106 | %{nil} |
107 | ||
1a9213c5 | 108 | %{__make} mod_pagespeed js_minify css_minify_main \ |
08710a2f ER |
109 | BUILDTYPE=%{!?debug:Release}%{?debug:Debug} \ |
110 | %{?with_verbose:V=1} \ | |
111 | CC="%{__cc}" \ | |
112 | CXX="%{__cxx}" \ | |
113 | CC.host="%{__cc}" \ | |
114 | CXX.host="%{__cxx}" \ | |
115 | LINK.host="%{__cxx}" \ | |
116 | CFLAGS="%{rpmcflags} %{rpmcppflags}" \ | |
117 | CXXFLAGS="%{rpmcxxflags} %{rpmcppflags}" \ | |
5bdfa704 | 118 | %{nil} |
08710a2f ER |
119 | |
120 | %install | |
121 | rm -rf $RPM_BUILD_ROOT | |
1a9213c5 ER |
122 | install -d $RPM_BUILD_ROOT{%{_pkglibdir},%{_sysconfdir},%{_bindir},%{cachedir}} |
123 | ||
5bdfa704 | 124 | %{__make} -j1 -C install staging_except_module \ |
06daee42 | 125 | APACHE_ROOT=%{_pkgrootdir} \ |
3f27b998 | 126 | APACHE_MODULES=modules \ |
06daee42 | 127 | APACHE_DOC_ROOT=%{htdocsdir} \ |
5bdfa704 ER |
128 | MOD_PAGESPEED_CACHE=%{cachedir} \ |
129 | MOD_PAGESPEED_STATS_LOG=/var/log/httpd/mod_pagespeed_stats.log \ | |
06daee42 ER |
130 | STAGING_DIR=staging |
131 | ||
1a9213c5 ER |
132 | out=out/%{!?debug:Release}%{?debug:Debug} |
133 | install -p $out/libmod_%{mod_name}.so $RPM_BUILD_ROOT%{_pkglibdir}/mod_%{mod_name}.so | |
134 | install -p $out/js_minify $RPM_BUILD_ROOT%{_bindir}/pagespeed_js_minify | |
135 | install -p $out/css_minify_main $RPM_BUILD_ROOT%{_bindir}/pagespeed_css_minify | |
136 | ||
5bdfa704 | 137 | cd install/staging |
06daee42 ER |
138 | cat > $RPM_BUILD_ROOT%{_sysconfdir}/90_mod_%{mod_name}.conf <<EOF |
139 | LoadModule %{mod_name}_module modules/mod_%{mod_name}.so | |
140 | ||
141 | $(cat pagespeed.conf) | |
142 | EOF | |
08710a2f | 143 | |
1a9213c5 ER |
144 | cp -p pagespeed_libraries.conf $RPM_BUILD_ROOT%{_sysconfdir}/91_mod_%{mod_name}_libraries.conf |
145 | ||
3f27b998 ER |
146 | install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} |
147 | cp -a mod_pagespeed_example/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} | |
148 | ||
08710a2f ER |
149 | %clean |
150 | rm -rf $RPM_BUILD_ROOT | |
151 | ||
152 | %post | |
153 | %service -q httpd restart | |
154 | ||
155 | %postun | |
156 | if [ "$1" = "0" ]; then | |
157 | %service -q httpd restart | |
158 | fi | |
159 | ||
160 | %files | |
161 | %defattr(644,root,root,755) | |
08710a2f | 162 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*_mod_%{mod_name}.conf |
1a9213c5 ER |
163 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*_mod_%{mod_name}_libraries.conf |
164 | %attr(755,root,root) %{_bindir}/pagespeed_css_minify | |
165 | %attr(755,root,root) %{_bindir}/pagespeed_js_minify | |
b6a5d8d0 | 166 | %attr(755,root,root) %{_pkglibdir}/mod_%{mod_name}.so |
3f27b998 | 167 | %{_examplesdir}/%{name}-%{version} |
5bdfa704 | 168 | %dir %attr(770,root,http) %{cachedir} |