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 # - use only source for modpagespeed if system headers are used (remove copies from tarball)
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 %if "%{pld_release}" == "ac"
18 # add suffix, but allow ccache, etc in ~/.rpmmacros
19 %{expand:%%define __cc %(echo '%__cc' | sed -e 's,-gcc,-gcc4,')}
20 %{expand:%%define __cxx %(echo '%__cxx' | sed -e 's,-g++,-g++4,')}
21 %{expand:%%define __cpp %(echo '%__cpp' | sed -e 's,-gcc,-gcc4,')}
24 %define mod_name pagespeed
25 %define apxs %{_sbindir}/apxs
26 Summary: Apache module for rewriting web pages to reduce latency and bandwidth
27 Name: apache-mod_%{mod_name}
31 Group: Networking/Daemons/HTTP
32 Source0: modpagespeed-%{version}.tar.bz2
33 # Source0-md5: 447f11184ab8b82f59b07a3e3b99425a
34 Source1: get-source.sh
35 Patch0: system-libs.patch
36 Patch1: gcc-headers.patch
37 URL: https://developers.google.com/speed/pagespeed/
38 BuildRequires: %{apxs}
39 BuildRequires: apache-devel >= 2.2
40 BuildRequires: glib2-devel
42 BuildRequires: libjpeg-devel
43 BuildRequires: libselinux-devel
44 BuildRequires: libstdc++-devel >= 5:4.1
45 BuildRequires: opencv-devel
46 BuildRequires: openssl-devel
47 BuildRequires: pkgconfig
48 BuildRequires: python-devel >= 1:2.6
49 BuildRequires: python-gyp
50 BuildRequires: rpmbuild(macros) >= 1.268
51 BuildRequires: util-linux
52 BuildRequires: zlib-devel
53 # gcc4 might be installed, but not current __cc
54 %if "%(echo %{cc_version} | cut -d. -f1,2)" < "4.0"
55 BuildRequires: __cc >= 4.0
57 Requires: apache(modules-api) = %apache_modules_api
58 Requires: apache-mod_authz_host
59 Requires: apache-mod_headers
60 Suggests: apache-mod_deflate
61 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
63 %define _pkglibdir %(%{apxs} -q LIBEXECDIR 2>/dev/null)
64 %define _pkgrootdir %(%{apxs} -q SYSCONFDIR 2>/dev/null)
65 %define _sysconfdir %{_pkgrootdir}/conf.d
66 %define htdocsdir %(%{apxs} -q htdocsdir 2>/dev/null)
67 %define cachedir %(%{apxs} -q proxycachedir 2>/dev/null)/mod_%{mod_name}
70 mod_pagespeed automates the application of those rules in an Apache
71 server. HTML, CSS, JavaScript, and images are changed dynamically
72 during the web serving process, so that the best practices recommended
73 by Page Speed can be used without having to change the way the web
77 %setup -q -n modpagespeed
86 %{__python} build/gyp_chromium --format=make build/all.gyp \
88 -Duse_system_apache_dev=1 \
89 -Duse_system_libjpeg=1 \
90 -Duse_system_libpng=1 \
91 -Duse_system_opencv=1 \
97 # makefile wrapper so we could just invoke "make" from shell
98 cat > Makefile <<'EOF'
99 # target names from build/all.gyp
101 $(MAKE) -C src mod_pagespeed \
102 BUILDTYPE=%{!?debug:Release}%{?debug:Debug} \
103 %{?with_verbose:V=1} \
107 CXX.host="%{__cxx}" \
108 LINK.host="%{__cxx}" \
109 CFLAGS="%{rpmcflags} %{rpmcppflags}" \
110 CXXFLAGS="%{rpmcxxflags} %{rpmcppflags}" \
116 rm -rf $RPM_BUILD_ROOT
117 install -d $RPM_BUILD_ROOT{%{_pkglibdir},%{_sysconfdir},%{cachedir}/{cache,files}}
118 %{__make} -j1 -C src/install staging_except_module \
120 APACHE_ROOT=%{_pkgrootdir} \
121 APACHE_MODULES=modules \
122 APACHE_DOC_ROOT=%{htdocsdir} \
123 MOD_PAGESPEED_FILE_ROOT=%{cachedir} \
126 install -p src/out/Release/libmod_%{mod_name}.so $RPM_BUILD_ROOT%{_pkglibdir}/mod_%{mod_name}.so
127 cd src/install/staging
128 cat > $RPM_BUILD_ROOT%{_sysconfdir}/90_mod_%{mod_name}.conf <<EOF
129 LoadModule %{mod_name}_module modules/mod_%{mod_name}.so
131 $(cat pagespeed.conf)
134 install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
135 cp -a mod_pagespeed_example/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
138 rm -rf $RPM_BUILD_ROOT
141 %service -q httpd restart
144 if [ "$1" = "0" ]; then
145 %service -q httpd restart
149 %defattr(644,root,root,755)
150 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*_mod_%{mod_name}.conf
151 %attr(755,root,root) %{_pkglibdir}/mod_%{mod_name}.so
152 %{_examplesdir}/%{name}-%{version}
154 %dir %attr(710,root,http) %{cachedir}
155 %dir %attr(770,root,http) %{cachedir}/cache
156 %dir %attr(770,root,http) %{cachedir}/files