]>
Commit | Line | Data |
---|---|---|
757b3ba5 ER |
1 | # |
2 | # Conditional build: | |
42a31ab3 | 3 | %bcond_without verbose # verbose build (V=1) |
3fa299a0 | 4 | %bcond_with sse2 # use SSE2 instructions |
757b3ba5 | 5 | |
b6a5d8d0 | 6 | # NOTE |
e540e830 | 7 | # - relase notes: https://developers.google.com/speed/pagespeed/module/release_notes |
757b3ba5 | 8 | # - http://code.google.com/p/modpagespeed/wiki/HowToBuild |
eb743e9a | 9 | # - http://wiki.mediatemple.net/w/(dv)_HOWTO:_Install_mod_pagespeed |
b6a5d8d0 | 10 | # TODO |
a673cf5a ER |
11 | # - run unit tests |
12 | # third_party libraries: | |
13 | # - apr - using system apr package | |
14 | # - aprutil - using system apr-util, but from this repo modified apr_memcache2.c | |
15 | # - gflags - system package may work | |
16 | # - giflib - 4.1.6, no local modifications | |
17 | # - google-sparsehash | |
18 | # - httpd, httpd24 - using system apache-devel | |
19 | # - icu - using system icu | |
20 | # - jsoncpp - no local changes | |
21 | # - libjpeg_turbo - 1.2.80 with chromium changes (but system lib should be fine) | |
22 | # - libpng - no local changes | |
23 | # - libwebp - 0.4.0, irrelevant local changes | |
24 | # - optipng - 0.7.4, local changes: only the opngreduc component of optipng is included. | |
25 | # - protobuf - should be possible to use full protobuf (not lite) to gain same functionality | |
26 | # - re2 - should be possible to use system re2 | |
27 | # - serf - 0.7.2 bunch of google fixes | |
28 | # - zlib - 1.2.5, no local changes | |
29 | # | |
30 | # third_party/chromium/src/base/third_party: | |
31 | # - nspr - should be possible to use system lib | |
32 | # - dmg_fp | |
33 | # - dynamic_annotations | |
34 | # - icu - not icu lib, but two files only | |
35 | # - valgrind | |
36 | # | |
37 | # could be possible to use system libs, not packaged in pld: | |
38 | # - base64 | |
39 | # - chromium | |
40 | # - chromium_deps | |
41 | # - css_parser | |
42 | # - domain_registry_provider | |
43 | # - instaweb | |
44 | # - mod_spdy | |
45 | # - modp_b64 | |
46 | # - rdestl | |
24f1647c | 47 | |
08710a2f | 48 | %define mod_name pagespeed |
cad452c8 | 49 | %define apxs %{_sbindir}/apxs |
08710a2f ER |
50 | Summary: Apache module for rewriting web pages to reduce latency and bandwidth |
51 | Name: apache-mod_%{mod_name} | |
21b9e54a | 52 | # beta: 1.9.32.x-beta |
36c8c93e ER |
53 | # stable: 1.9.32.x-stable |
54 | Version: 1.9.32.4 | |
94800431 | 55 | Release: 8 |
08710a2f ER |
56 | License: Apache v2.0 |
57 | Group: Networking/Daemons/HTTP | |
1df21b0a JB |
58 | #Source0Download: https://github.com/pagespeed/mod_pagespeed/releases |
59 | #Source0: https://github.com/pagespeed/mod_pagespeed/archive/%{version}/mod_pagespeed-%{version}.tar.gz | |
4623c72a | 60 | Source0: modpagespeed-%{version}.tar.xz |
b7aa23f7 | 61 | # Source0-md5: c6740a5de9cb7f20f0cf29c8835f6f95 |
b74b29a5 | 62 | Source1: get-source.sh |
5a3e561c | 63 | Source2: gclient.conf |
42a31ab3 | 64 | Patch0: system-libs.patch |
399d2a8e | 65 | Patch1: addrinfo.patch |
1a9213c5 | 66 | Patch2: bug-632.patch |
cad452c8 | 67 | Patch4: no-dev-stdout.patch |
a16986b1 | 68 | Patch5: apache24-config.patch |
72de4a4c | 69 | Patch6: no-force-xxbit.patch |
3fa299a0 | 70 | Patch7: no-arch-opt.patch |
1df21b0a | 71 | Patch8: %{name}-icu.patch |
6772b4d7 JB |
72 | Patch9: %{name}-format.patch |
73 | Patch10: serf-openssl1.1.patch | |
2022f310 | 74 | Patch11: %{name}-system-protobuf.patch |
59548b66 | 75 | URL: https://developers.google.com/speed/pagespeed/module |
08710a2f ER |
76 | BuildRequires: %{apxs} |
77 | BuildRequires: apache-devel >= 2.2 | |
ffebf8bc | 78 | BuildRequires: bash |
42a31ab3 | 79 | BuildRequires: glib2-devel |
3f27b998 | 80 | BuildRequires: gperf |
99c7dfcb | 81 | BuildRequires: libicu-devel |
3fa299a0 JR |
82 | BuildRequires: libjpeg-turbo-devel |
83 | BuildRequires: libpng-devel | |
42a31ab3 | 84 | BuildRequires: libselinux-devel |
b74b29a5 | 85 | BuildRequires: libstdc++-devel >= 5:4.1 |
4623c72a | 86 | BuildRequires: opencv-devel >= 2.3.1 |
6772b4d7 | 87 | BuildRequires: openssl-devel >= 1.1 |
3f27b998 | 88 | BuildRequires: pkgconfig |
2022f310 | 89 | BuildRequires: protobuf-devel |
757b3ba5 | 90 | BuildRequires: python-devel >= 1:2.6 |
5eafce75 | 91 | BuildRequires: yasm |
4623c72a ER |
92 | # This version of gyp is new enough that it knows to use make for Linux 3.x |
93 | # and FreeBSD, but old enough that 'type': 'settings' works and | |
94 | # LINKER_SUPPORTS_ICF hasn't been removed yet. | |
3fbdacfc | 95 | BuildRequires: python-gyp >= 0.1-0.svn1602.1 |
08710a2f | 96 | BuildRequires: rpmbuild(macros) >= 1.268 |
4623c72a | 97 | BuildRequires: tar >= 1:1.22 |
2ddcd200 | 98 | BuildRequires: util-linux |
4623c72a | 99 | BuildRequires: xz |
42a31ab3 | 100 | BuildRequires: zlib-devel |
22e6311f | 101 | BuildConflicts: depot_tools < 0.1-0.20150708 |
08710a2f | 102 | Requires: apache(modules-api) = %apache_modules_api |
e5171f2e | 103 | Requires: apache-mod_authz_host |
3f27b998 | 104 | Requires: apache-mod_headers |
b6a5d8d0 | 105 | Suggests: apache-mod_deflate |
08710a2f ER |
106 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
107 | ||
108 | %define _pkglibdir %(%{apxs} -q LIBEXECDIR 2>/dev/null) | |
06daee42 ER |
109 | %define _pkgrootdir %(%{apxs} -q SYSCONFDIR 2>/dev/null) |
110 | %define _sysconfdir %{_pkgrootdir}/conf.d | |
111 | %define htdocsdir %(%{apxs} -q htdocsdir 2>/dev/null) | |
112 | %define cachedir %(%{apxs} -q proxycachedir 2>/dev/null)/mod_%{mod_name} | |
08710a2f | 113 | |
59d9f80d ER |
114 | # disable strip examples, http://lists.pld-linux.org/mailman/pipermail/pld-devel-en/2015-January/024223.html |
115 | %define _noautostrip .*%{_examplesdir}/.* | |
116 | ||
08710a2f ER |
117 | %description |
118 | mod_pagespeed automates the application of those rules in an Apache | |
119 | server. HTML, CSS, JavaScript, and images are changed dynamically | |
120 | during the web serving process, so that the best practices recommended | |
121 | by Page Speed can be used without having to change the way the web | |
122 | site is maintained. | |
123 | ||
124 | %prep | |
5bdfa704 | 125 | %setup -q -n modpagespeed-%{version} |
3fa299a0 | 126 | %patch0 -p1 |
399d2a8e | 127 | %patch1 -p0 |
ce5a7d18 | 128 | %patch2 -p1 |
9c41f6b1 | 129 | %patch4 -p1 |
a16986b1 | 130 | %patch5 -p1 |
72de4a4c | 131 | %patch6 -p1 |
3fa299a0 | 132 | %patch7 -p1 |
1df21b0a | 133 | %patch8 -p1 |
6772b4d7 JB |
134 | %patch9 -p1 |
135 | %patch10 -p1 | |
2022f310 | 136 | %patch11 -p1 |
08710a2f | 137 | |
b7aa23f7 | 138 | %if 0 |
36c8c93e | 139 | sh -x %{_sourcedir}/clean-source.sh |
b7aa23f7 | 140 | %endif |
36c8c93e | 141 | |
3fa299a0 JR |
142 | %{__rm} -r third_party/icu/source |
143 | %{__rm} -r third_party/icu/genfiles | |
1df21b0a | 144 | # third_party_chromium uses "third_party/icu/..." includes |
99c7dfcb ER |
145 | install -d third_party/icu/source/{common,i18n} |
146 | ln -s %{_includedir}/unicode third_party/icu/source/i18n/unicode | |
147 | ln -s %{_includedir}/unicode third_party/icu/source/common/unicode | |
08710a2f | 148 | |
2022f310 JB |
149 | %{__rm} -r third_party/protobuf/src |
150 | ||
08710a2f | 151 | %build |
eb743e9a | 152 | # re-gen makefiles |
e62ba6cb ER |
153 | CC="%{__cc}" \ |
154 | CXX="%{__cxx}" \ | |
5bdfa704 ER |
155 | %{__python} build/gyp_chromium \ |
156 | --format=make \ | |
157 | --depth=. \ | |
158 | build/all.gyp \ | |
3fa299a0 | 159 | %{!?with_sse2:-Ddisable_sse2=1} \ |
42a31ab3 ER |
160 | -Duse_openssl=1 \ |
161 | -Duse_system_apache_dev=1 \ | |
99c7dfcb | 162 | -Duse_system_icu=1 \ |
42a31ab3 ER |
163 | -Duse_system_libjpeg=1 \ |
164 | -Duse_system_libpng=1 \ | |
165 | -Duse_system_opencv=1 \ | |
99c7dfcb | 166 | -Duse_system_openssl=1 \ |
2022f310 | 167 | -Duse_system_protobuf=1 \ |
5eafce75 | 168 | -Duse_system_yasm=1 \ |
42a31ab3 | 169 | -Duse_system_zlib=1 \ |
b2f50394 ER |
170 | -Dsystem_include_path_apr=%{_includedir}/apr \ |
171 | -Dsystem_include_path_aprutil=%{_includedir}/apr-util \ | |
172 | -Dsystem_include_path_httpd=%{_includedir}/apache \ | |
42a31ab3 ER |
173 | %{nil} |
174 | ||
1a9213c5 | 175 | %{__make} mod_pagespeed js_minify css_minify_main \ |
08710a2f ER |
176 | BUILDTYPE=%{!?debug:Release}%{?debug:Debug} \ |
177 | %{?with_verbose:V=1} \ | |
178 | CC="%{__cc}" \ | |
179 | CXX="%{__cxx}" \ | |
180 | CC.host="%{__cc}" \ | |
181 | CXX.host="%{__cxx}" \ | |
182 | LINK.host="%{__cxx}" \ | |
3fa299a0 JR |
183 | CFLAGS="%{rpmcflags} %{rpmcppflags} -DUSE_SYSTEM_LIBJPEG" \ |
184 | CXXFLAGS="%{rpmcxxflags} %{rpmcppflags} -DUSE_SYSTEM_LIBJPEG" \ | |
5bdfa704 | 185 | %{nil} |
08710a2f ER |
186 | |
187 | %install | |
188 | rm -rf $RPM_BUILD_ROOT | |
1a9213c5 ER |
189 | install -d $RPM_BUILD_ROOT{%{_pkglibdir},%{_sysconfdir},%{_bindir},%{cachedir}} |
190 | ||
5bdfa704 | 191 | %{__make} -j1 -C install staging_except_module \ |
06daee42 | 192 | APACHE_ROOT=%{_pkgrootdir} \ |
3f27b998 | 193 | APACHE_MODULES=modules \ |
06daee42 | 194 | APACHE_DOC_ROOT=%{htdocsdir} \ |
5bdfa704 ER |
195 | MOD_PAGESPEED_CACHE=%{cachedir} \ |
196 | MOD_PAGESPEED_STATS_LOG=/var/log/httpd/mod_pagespeed_stats.log \ | |
06daee42 ER |
197 | STAGING_DIR=staging |
198 | ||
1a9213c5 ER |
199 | out=out/%{!?debug:Release}%{?debug:Debug} |
200 | install -p $out/libmod_%{mod_name}.so $RPM_BUILD_ROOT%{_pkglibdir}/mod_%{mod_name}.so | |
201 | install -p $out/js_minify $RPM_BUILD_ROOT%{_bindir}/pagespeed_js_minify | |
202 | install -p $out/css_minify_main $RPM_BUILD_ROOT%{_bindir}/pagespeed_css_minify | |
203 | ||
5bdfa704 | 204 | cd install/staging |
06daee42 ER |
205 | cat > $RPM_BUILD_ROOT%{_sysconfdir}/90_mod_%{mod_name}.conf <<EOF |
206 | LoadModule %{mod_name}_module modules/mod_%{mod_name}.so | |
207 | ||
208 | $(cat pagespeed.conf) | |
209 | EOF | |
08710a2f | 210 | |
1a9213c5 ER |
211 | cp -p pagespeed_libraries.conf $RPM_BUILD_ROOT%{_sysconfdir}/91_mod_%{mod_name}_libraries.conf |
212 | ||
3f27b998 ER |
213 | install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} |
214 | cp -a mod_pagespeed_example/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} | |
215 | ||
08710a2f ER |
216 | %clean |
217 | rm -rf $RPM_BUILD_ROOT | |
218 | ||
219 | %post | |
220 | %service -q httpd restart | |
221 | ||
222 | %postun | |
223 | if [ "$1" = "0" ]; then | |
224 | %service -q httpd restart | |
225 | fi | |
226 | ||
227 | %files | |
228 | %defattr(644,root,root,755) | |
08710a2f | 229 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*_mod_%{mod_name}.conf |
1a9213c5 ER |
230 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*_mod_%{mod_name}_libraries.conf |
231 | %attr(755,root,root) %{_bindir}/pagespeed_css_minify | |
232 | %attr(755,root,root) %{_bindir}/pagespeed_js_minify | |
b6a5d8d0 | 233 | %attr(755,root,root) %{_pkglibdir}/mod_%{mod_name}.so |
3f27b998 | 234 | %{_examplesdir}/%{name}-%{version} |
5bdfa704 | 235 | %dir %attr(770,root,http) %{cachedir} |