3 %bcond_without verbose # verbose build (V=1)
6 # - relase notes: https://developers.google.com/speed/pagespeed/module/release_notes
7 # - http://code.google.com/p/modpagespeed/wiki/HowToBuild
8 # - http://wiki.mediatemple.net/w/(dv)_HOWTO:_Install_mod_pagespeed
10 # - add unit tests running
11 # - possible sysdeps (uses release tags)
12 # "serf_src": "http://serf.googlecode.com/svn/tags/0.3.1",
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",
17 %define mod_name pagespeed
18 %define apxs %{_sbindir}/apxs
19 Summary: Apache module for rewriting web pages to reduce latency and bandwidth
20 Name: apache-mod_%{mod_name}
24 Group: Networking/Daemons/HTTP
25 Source0: modpagespeed-%{version}.tar.xz
26 # Source0-md5: fa8d6a80fc4ca7f929910fa4eeb4a941
27 Source1: get-source.sh
29 Patch0: system-libs.patch
30 Patch1: gcc-headers.patch
33 Patch4: no-dev-stdout.patch
34 URL: https://developers.google.com/speed/pagespeed/module
35 BuildRequires: %{apxs}
36 BuildRequires: apache-devel >= 2.2
37 BuildRequires: glib2-devel
39 BuildRequires: libselinux-devel
40 BuildRequires: libstdc++-devel >= 5:4.1
41 BuildRequires: opencv-devel >= 2.3.1
42 BuildRequires: openssl-devel
43 BuildRequires: pkgconfig
44 BuildRequires: python-devel >= 1:2.6
45 # This version of gyp is new enough that it knows to use make for Linux 3.x
46 # and FreeBSD, but old enough that 'type': 'settings' works and
47 # LINKER_SUPPORTS_ICF hasn't been removed yet.
48 BuildRequires: python-gyp >= 0.1-0.svn1602.1
49 BuildRequires: rpmbuild(macros) >= 1.268
50 BuildRequires: tar >= 1:1.22
51 BuildRequires: util-linux
53 BuildRequires: zlib-devel
54 Requires: apache(modules-api) = %apache_modules_api
55 Requires: apache-mod_authz_host
56 Requires: apache-mod_headers
57 Suggests: apache-mod_deflate
58 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
60 %define _pkglibdir %(%{apxs} -q LIBEXECDIR 2>/dev/null)
61 %define _pkgrootdir %(%{apxs} -q SYSCONFDIR 2>/dev/null)
62 %define _sysconfdir %{_pkgrootdir}/conf.d
63 %define htdocsdir %(%{apxs} -q htdocsdir 2>/dev/null)
64 %define cachedir %(%{apxs} -q proxycachedir 2>/dev/null)/mod_%{mod_name}
67 mod_pagespeed automates the application of those rules in an Apache
68 server. HTML, CSS, JavaScript, and images are changed dynamically
69 during the web serving process, so that the best practices recommended
70 by Page Speed can be used without having to change the way the web
74 %setup -q -n modpagespeed-%{version}
85 %{__python} build/gyp_chromium \
90 -Duse_system_apache_dev=1 \
91 -Duse_system_libjpeg=1 \
92 -Duse_system_libpng=1 \
93 -Duse_system_opencv=1 \
95 -Dsystem_include_path_apr=%{_includedir}/apr \
96 -Dsystem_include_path_aprutil=%{_includedir}/apr-util \
97 -Dsystem_include_path_httpd=%{_includedir}/apache \
100 %{__make} mod_pagespeed js_minify css_minify_main \
101 BUILDTYPE=%{!?debug:Release}%{?debug:Debug} \
102 %{?with_verbose:V=1} \
106 CXX.host="%{__cxx}" \
107 LINK.host="%{__cxx}" \
108 CFLAGS="%{rpmcflags} %{rpmcppflags}" \
109 CXXFLAGS="%{rpmcxxflags} %{rpmcppflags}" \
113 rm -rf $RPM_BUILD_ROOT
114 install -d $RPM_BUILD_ROOT{%{_pkglibdir},%{_sysconfdir},%{_bindir},%{cachedir}}
116 %{__make} -j1 -C install staging_except_module \
117 APACHE_ROOT=%{_pkgrootdir} \
118 APACHE_MODULES=modules \
119 APACHE_DOC_ROOT=%{htdocsdir} \
120 MOD_PAGESPEED_CACHE=%{cachedir} \
121 MOD_PAGESPEED_STATS_LOG=/var/log/httpd/mod_pagespeed_stats.log \
124 out=out/%{!?debug:Release}%{?debug:Debug}
125 install -p $out/libmod_%{mod_name}.so $RPM_BUILD_ROOT%{_pkglibdir}/mod_%{mod_name}.so
126 install -p $out/js_minify $RPM_BUILD_ROOT%{_bindir}/pagespeed_js_minify
127 install -p $out/css_minify_main $RPM_BUILD_ROOT%{_bindir}/pagespeed_css_minify
130 cat > $RPM_BUILD_ROOT%{_sysconfdir}/90_mod_%{mod_name}.conf <<EOF
131 LoadModule %{mod_name}_module modules/mod_%{mod_name}.so
133 $(cat pagespeed.conf)
136 cp -p pagespeed_libraries.conf $RPM_BUILD_ROOT%{_sysconfdir}/91_mod_%{mod_name}_libraries.conf
138 install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
139 cp -a mod_pagespeed_example/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
142 rm -rf $RPM_BUILD_ROOT
145 %service -q httpd restart
148 if [ "$1" = "0" ]; then
149 %service -q httpd restart
153 %defattr(644,root,root,755)
154 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*_mod_%{mod_name}.conf
155 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*_mod_%{mod_name}_libraries.conf
156 %attr(755,root,root) %{_bindir}/pagespeed_css_minify
157 %attr(755,root,root) %{_bindir}/pagespeed_js_minify
158 %attr(755,root,root) %{_pkglibdir}/mod_%{mod_name}.so
159 %{_examplesdir}/%{name}-%{version}
160 %dir %attr(770,root,http) %{cachedir}