3 %bcond_without verbose # verbose build (V=1)
6 # - http://code.google.com/p/modpagespeed/wiki/HowToBuild
7 # - http://wiki.mediatemple.net/w/(dv)_HOWTO:_Install_mod_pagespeed
9 # - add unit tests running
10 # - possible sysdeps (uses release tags)
11 # "serf_src": "http://serf.googlecode.com/svn/tags/0.3.1",
12 # "gflags_root": "http://google-gflags.googlecode.com/svn/tags/gflags-1.3/src",
13 # "google_sparsehash_root": "http://google-sparsehash.googlecode.com/svn/tags/sparsehash-1.8.1/src",
16 %if "%{pld_release}" == "ac"
17 # add suffix, but allow ccache, etc in ~/.rpmmacros
18 %{expand:%%define __cc %(echo '%__cc' | sed -e 's,-gcc,-gcc4,')}
19 %{expand:%%define __cxx %(echo '%__cxx' | sed -e 's,-g++,-g++4,')}
20 %{expand:%%define __cpp %(echo '%__cpp' | sed -e 's,-gcc,-gcc4,')}
23 %define mod_name pagespeed
24 %define apxs %{_sbindir}/apxs
25 Summary: Apache module for rewriting web pages to reduce latency and bandwidth
26 Name: apache-mod_%{mod_name}
30 Group: Networking/Daemons/HTTP
31 Source0: modpagespeed-%{version}.tar.xz
32 # Source0-md5: fa8d6a80fc4ca7f929910fa4eeb4a941
33 Source1: get-source.sh
35 Patch0: system-libs.patch
36 Patch1: gcc-headers.patch
39 Patch4: no-dev-stdout.patch
40 URL: https://developers.google.com/speed/pagespeed/
41 BuildRequires: %{apxs}
42 BuildRequires: apache-devel >= 2.2
43 BuildRequires: glib2-devel
45 BuildRequires: libselinux-devel
46 BuildRequires: libstdc++-devel >= 5:4.1
47 BuildRequires: opencv-devel >= 2.3.1
48 BuildRequires: openssl-devel
49 BuildRequires: pkgconfig
50 BuildRequires: python-devel >= 1:2.6
51 # This version of gyp is new enough that it knows to use make for Linux 3.x
52 # and FreeBSD, but old enough that 'type': 'settings' works and
53 # LINKER_SUPPORTS_ICF hasn't been removed yet.
54 BuildRequires: python-gyp >= 0.1-0.svn1602.1
55 BuildRequires: rpmbuild(macros) >= 1.268
56 BuildRequires: tar >= 1:1.22
57 BuildRequires: util-linux
59 BuildRequires: zlib-devel
60 # gcc4 might be installed, but not current __cc
61 %if "%(echo %{cc_version} | cut -d. -f1,2)" < "4.0"
62 BuildRequires: __cc >= 4.0
64 Requires: apache(modules-api) = %apache_modules_api
65 Requires: apache-mod_authz_host
66 Requires: apache-mod_headers
67 Suggests: apache-mod_deflate
68 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
70 %define _pkglibdir %(%{apxs} -q LIBEXECDIR 2>/dev/null)
71 %define _pkgrootdir %(%{apxs} -q SYSCONFDIR 2>/dev/null)
72 %define _sysconfdir %{_pkgrootdir}/conf.d
73 %define htdocsdir %(%{apxs} -q htdocsdir 2>/dev/null)
74 %define cachedir %(%{apxs} -q proxycachedir 2>/dev/null)/mod_%{mod_name}
77 mod_pagespeed automates the application of those rules in an Apache
78 server. HTML, CSS, JavaScript, and images are changed dynamically
79 during the web serving process, so that the best practices recommended
80 by Page Speed can be used without having to change the way the web
84 %setup -q -n modpagespeed-%{version}
95 %{__python} build/gyp_chromium \
100 -Duse_system_apache_dev=1 \
101 -Duse_system_libjpeg=1 \
102 -Duse_system_libpng=1 \
103 -Duse_system_opencv=1 \
104 -Duse_system_zlib=1 \
105 -Dsystem_include_path_apr=%{_includedir}/apr \
106 -Dsystem_include_path_aprutil=%{_includedir}/apr-util \
107 -Dsystem_include_path_httpd=%{_includedir}/apache \
110 %{__make} mod_pagespeed js_minify css_minify_main \
111 BUILDTYPE=%{!?debug:Release}%{?debug:Debug} \
112 %{?with_verbose:V=1} \
116 CXX.host="%{__cxx}" \
117 LINK.host="%{__cxx}" \
118 CFLAGS="%{rpmcflags} %{rpmcppflags}" \
119 CXXFLAGS="%{rpmcxxflags} %{rpmcppflags}" \
123 rm -rf $RPM_BUILD_ROOT
124 install -d $RPM_BUILD_ROOT{%{_pkglibdir},%{_sysconfdir},%{_bindir},%{cachedir}}
126 %{__make} -j1 -C install staging_except_module \
127 APACHE_ROOT=%{_pkgrootdir} \
128 APACHE_MODULES=modules \
129 APACHE_DOC_ROOT=%{htdocsdir} \
130 MOD_PAGESPEED_CACHE=%{cachedir} \
131 MOD_PAGESPEED_STATS_LOG=/var/log/httpd/mod_pagespeed_stats.log \
134 out=out/%{!?debug:Release}%{?debug:Debug}
135 install -p $out/libmod_%{mod_name}.so $RPM_BUILD_ROOT%{_pkglibdir}/mod_%{mod_name}.so
136 install -p $out/js_minify $RPM_BUILD_ROOT%{_bindir}/pagespeed_js_minify
137 install -p $out/css_minify_main $RPM_BUILD_ROOT%{_bindir}/pagespeed_css_minify
140 cat > $RPM_BUILD_ROOT%{_sysconfdir}/90_mod_%{mod_name}.conf <<EOF
141 LoadModule %{mod_name}_module modules/mod_%{mod_name}.so
143 $(cat pagespeed.conf)
146 cp -p pagespeed_libraries.conf $RPM_BUILD_ROOT%{_sysconfdir}/91_mod_%{mod_name}_libraries.conf
148 install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
149 cp -a mod_pagespeed_example/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
152 rm -rf $RPM_BUILD_ROOT
155 %service -q httpd restart
158 if [ "$1" = "0" ]; then
159 %service -q httpd restart
163 %defattr(644,root,root,755)
164 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*_mod_%{mod_name}.conf
165 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*_mod_%{mod_name}_libraries.conf
166 %attr(755,root,root) %{_bindir}/pagespeed_css_minify
167 %attr(755,root,root) %{_bindir}/pagespeed_js_minify
168 %attr(755,root,root) %{_pkglibdir}/mod_%{mod_name}.so
169 %{_examplesdir}/%{name}-%{version}
170 %dir %attr(770,root,http) %{cachedir}