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 # - c++ errors on 64bit/32bit gcc 4.5.1-4:
11 # /usr/include/c++/4.5.1/bits/stl_map.h:87:5: instantiated from here
12 # /usr/include/c++/4.5.1/bits/stl_pair.h:77:11: error: ‘std::pair<_T1, _T2>::second’ has incomplete type
13 # ./net/instaweb/util/public/cache_interface.h:28:7: error: forward declaration of ‘struct net_instaweb::SharedString’
14 # make[1]: *** [out/Release/obj.target/mod_pagespeed_test/net/instaweb/util/cache_fetcher_test.o] Error 1
15 # http://pastebin.com/Eu88BPSQ
16 # - sizeof(apr_int32_t) == sizeof(apr_int64_t) on 32bit (!?!):
17 # third_party/apache/apr/src/strings/apr_snprintf.c: In function 'conv_os_thread_t':
18 # third_party/apache/apr/src/strings/apr_snprintf.c:500:5: error: duplicate case value
19 # third_party/apache/apr/src/strings/apr_snprintf.c:498:5: error: previously used here
20 # third_party/apache/apr/src/strings/apr_snprintf.c: In function 'conv_os_thread_t_hex':
21 # third_party/apache/apr/src/strings/apr_snprintf.c:671:5: error: duplicate case value
22 # third_party/apache/apr/src/strings/apr_snprintf.c:669:5: error: previously used here
23 # - use only source for modpagespeed if system headers are used (remove copies from tarball)
24 # - possible sysdeps (uses release tags)
25 # "serf_src": "http://serf.googlecode.com/svn/tags/0.3.1",
26 # "apache_httpd_src": "http://svn.apache.org/repos/asf/httpd/httpd/tags/2.2.15",
27 # "gflags_root": "http://google-gflags.googlecode.com/svn/tags/gflags-1.3/src",
28 # "google_sparsehash_root": "http://google-sparsehash.googlecode.com/svn/tags/sparsehash-1.8.1/src",
31 %if "%{pld_release}" == "ac"
32 # add suffix, but allow ccache, etc in ~/.rpmmacros
33 %{expand:%%define __cc %(echo '%__cc' | sed -e 's,-gcc,-gcc4,')}
34 %{expand:%%define __cxx %(echo '%__cxx' | sed -e 's,-g++,-g++4,')}
35 %{expand:%%define __cpp %(echo '%__cpp' | sed -e 's,-gcc,-gcc4,')}
38 %define mod_name pagespeed
39 %define apxs %{_sbindir}/apxs
40 Summary: Apache module for rewriting web pages to reduce latency and bandwidth
41 Name: apache-mod_%{mod_name}
45 Group: Networking/Daemons/HTTP
46 Source0: modpagespeed-%{version}.tar.bz2
47 # Source0-md5: 9c9a8b091ee8d37253ee35878c3390e6
48 Source1: get-source.sh
49 Patch0: system-libs.patch
50 Patch1: gcc-headers.patch
51 URL: https://developers.google.com/speed/pagespeed/
52 BuildRequires: %{apxs}
53 BuildRequires: apache-devel >= 2.2
54 BuildRequires: dbus-glib-devel
55 BuildRequires: fontconfig-devel
56 BuildRequires: freetype-devel
57 BuildRequires: glib2-devel
58 BuildRequires: gtk+2-devel
59 BuildRequires: ibus-devel >= 1.3.99.20110425
60 BuildRequires: libgcrypt-devel
61 BuildRequires: libgnome-keyring-devel
62 BuildRequires: libjpeg-devel
63 BuildRequires: libpng-devel
64 BuildRequires: libselinux-devel
65 BuildRequires: libstdc++-devel >= 5:4.1
66 BuildRequires: opencv-devel
67 BuildRequires: openssl-devel
68 BuildRequires: python-devel >= 1:2.6
69 BuildRequires: rpmbuild(macros) >= 1.268
70 BuildRequires: xorg-lib-libX11-devel
71 BuildRequires: xorg-lib-libXext-devel
72 BuildRequires: xorg-lib-libXi-devel
73 BuildRequires: zlib-devel
74 # gcc4 might be installed, but not current __cc
75 %if "%(echo %{cc_version} | cut -d. -f1,2)" < "4.0"
76 BuildRequires: __cc >= 4.0
78 Requires: apache(modules-api) = %apache_modules_api
79 Requires: apache-mod_authz_host
80 Suggests: apache-mod_deflate
81 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
83 %define _pkglibdir %(%{apxs} -q LIBEXECDIR 2>/dev/null)
84 %define _pkgrootdir %(%{apxs} -q SYSCONFDIR 2>/dev/null)
85 %define _sysconfdir %{_pkgrootdir}/conf.d
86 %define htdocsdir %(%{apxs} -q htdocsdir 2>/dev/null)
87 %define cachedir %(%{apxs} -q proxycachedir 2>/dev/null)/mod_%{mod_name}
90 mod_pagespeed automates the application of those rules in an Apache
91 server. HTML, CSS, JavaScript, and images are changed dynamically
92 during the web serving process, so that the best practices recommended
93 by Page Speed can be used without having to change the way the web
97 %setup -q -n modpagespeed
106 %{__python} build/gyp_chromium --format=make build/all.gyp \
107 -Dlinux_link_gsettings=1 \
108 -Dlinux_link_gnome_keyring=1 \
109 -Duse_gnome_keyring=1 \
111 -Duse_system_apache_dev=1 \
112 -Duse_system_libjpeg=1 \
113 -Duse_system_libpng=1 \
114 -Duse_system_opencv=1 \
115 -Duse_system_zlib=1 \
121 # makefile wrapper so we could just invoke "make" from shell
122 cat > Makefile <<'EOF'
125 BUILDTYPE=%{!?debug:Release}%{?debug:Debug} \
126 %{?with_verbose:V=1} \
130 CXX.host="%{__cxx}" \
131 LINK.host="%{__cxx}" \
132 CFLAGS="%{rpmcflags} %{rpmcppflags}" \
133 CXXFLAGS="%{rpmcxxflags} %{rpmcppflags}" \
138 # install.gyp needs fixing, not to install ap24.so, for now duplicate
139 ln -f src/out/Release/libmod_pagespeed{,_ap24}.so
142 rm -rf $RPM_BUILD_ROOT
143 %{__make} -j1 -C src/install staging \
145 APACHE_ROOT=%{_pkgrootdir} \
146 APACHE_MODULES=%{_pkglibdir} \
147 APACHE_DOC_ROOT=%{htdocsdir} \
148 MOD_PAGESPEED_FILE_ROOT=%{cachedir} \
151 cd src/install/staging
152 install -d $RPM_BUILD_ROOT{%{_pkglibdir},%{_sysconfdir}}
153 install -p mod_%{mod_name}.so $RPM_BUILD_ROOT%{_pkglibdir}
154 install -d $RPM_BUILD_ROOT%{cachedir}/{cache,files}
155 cat > $RPM_BUILD_ROOT%{_sysconfdir}/90_mod_%{mod_name}.conf <<EOF
156 LoadModule %{mod_name}_module modules/mod_%{mod_name}.so
158 $(cat pagespeed.conf)
162 rm -rf $RPM_BUILD_ROOT
165 %service -q httpd restart
168 if [ "$1" = "0" ]; then
169 %service -q httpd restart
173 %defattr(644,root,root,755)
174 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*_mod_%{mod_name}.conf
175 %attr(755,root,root) %{_pkglibdir}/mod_%{mod_name}.so
177 %dir %attr(710,root,http) %{cachedir}
178 %dir %attr(770,root,http) %{cachedir}/cache
179 %dir %attr(770,root,http) %{cachedir}/files