3 %bcond_with verbose # verbose build (V=1)
6 # - use make < 3.82 (from th-obsolete) to hack on code, because 3.82
7 # invalidates built objects and it's annoying to wait if all is recompiled
8 # each time you invoke make
9 # - http://code.google.com/p/modpagespeed/wiki/HowToBuild
10 # - http://wiki.mediatemple.net/w/(dv)_HOWTO:_Install_mod_pagespeed
12 # - add unit tests running
13 # - c++ errors on 64bit/32bit gcc 4.5.1-4:
14 # /usr/include/c++/4.5.1/bits/stl_map.h:87:5: instantiated from here
15 # /usr/include/c++/4.5.1/bits/stl_pair.h:77:11: error: ‘std::pair<_T1, _T2>::second’ has incomplete type
16 # ./net/instaweb/util/public/cache_interface.h:28:7: error: forward declaration of ‘struct net_instaweb::SharedString’
17 # make[1]: *** [out/Release/obj.target/mod_pagespeed_test/net/instaweb/util/cache_fetcher_test.o] Error 1
18 # http://pastebin.com/Eu88BPSQ
19 # - sizeof(apr_int32_t) == sizeof(apr_int64_t) on 32bit (!?!):
20 # third_party/apache/apr/src/strings/apr_snprintf.c: In function 'conv_os_thread_t':
21 # third_party/apache/apr/src/strings/apr_snprintf.c:500:5: error: duplicate case value
22 # third_party/apache/apr/src/strings/apr_snprintf.c:498:5: error: previously used here
23 # third_party/apache/apr/src/strings/apr_snprintf.c: In function 'conv_os_thread_t_hex':
24 # third_party/apache/apr/src/strings/apr_snprintf.c:671:5: error: duplicate case value
25 # third_party/apache/apr/src/strings/apr_snprintf.c:669:5: error: previously used here
26 # - possible sysdeps (uses release tags)
27 # "serf_src": "http://serf.googlecode.com/svn/tags/0.3.1",
28 # "apr_src": "http://svn.apache.org/repos/asf/apr/apr/tags/1.4.2",
29 # "aprutil_src": "http://svn.apache.org/repos/asf/apr/apr-util/tags/1.3.9",
30 # "apache_httpd_src": "http://svn.apache.org/repos/asf/httpd/httpd/tags/2.2.15",
31 # "opencv_src": "https://code.ros.org/svn/opencv/tags/2.1",
32 # "gflags_root": "http://google-gflags.googlecode.com/svn/tags/gflags-1.3/src",
33 # "google_sparsehash_root": "http://google-sparsehash.googlecode.com/svn/tags/sparsehash-1.8.1/src",
34 # - use only source for modpagespeed if system headers are used (remove copies from tarball)
35 %define mod_name pagespeed
36 %define apxs %{_sbindir}/apxs
37 Summary: Apache module for rewriting web pages to reduce latency and bandwidth
38 Name: apache-mod_%{mod_name}
42 Group: Networking/Daemons/HTTP
43 Source0: modpagespeed-%{version}.tar.bz2
44 # Source0-md5: d4a49e422da63d6487afbec731432e21
45 URL: http://code.google.com/p/modpagespeed/
46 BuildRequires: %{apxs}
47 BuildRequires: apache-devel >= 2.2
48 BuildRequires: libstdc++-devel >= 6:4.2
49 BuildRequires: python-devel >= 1:2.6
50 BuildRequires: rpmbuild(macros) >= 1.268
51 Requires: apache(modules-api) = %apache_modules_api
52 Requires: apache-mod_authz_host
53 Suggests: apache-mod_deflate
54 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
56 %define _pkglibdir %(%{apxs} -q LIBEXECDIR 2>/dev/null)
57 %define _pkgrootdir %(%{apxs} -q SYSCONFDIR 2>/dev/null)
58 %define _sysconfdir %{_pkgrootdir}/conf.d
59 %define htdocsdir %(%{apxs} -q htdocsdir 2>/dev/null)
60 %define cachedir %(%{apxs} -q proxycachedir 2>/dev/null)/mod_%{mod_name}
63 mod_pagespeed automates the application of those rules in an Apache
64 server. HTML, CSS, JavaScript, and images are changed dynamically
65 during the web serving process, so that the best practices recommended
66 by Page Speed can be used without having to change the way the web
70 %setup -q -n modpagespeed
77 %{__python} build/gyp_chromium --format=make build/all.gyp
80 # makefile wrapper so we could just invoke "make" from shell
81 cat > Makefile <<'EOF'
84 BUILDTYPE=%{!?debug:Release}%{?debug:Debug} \
85 %{?with_verbose:V=1} \
90 LINK.host="%{__cxx}" \
91 CFLAGS="%{rpmcflags} %{rpmcppflags}" \
92 CXXFLAGS="%{rpmcxxflags} %{rpmcppflags}" \
97 rm -rf $RPM_BUILD_ROOT
98 %{__make} -j1 -C src/install staging \
100 APACHE_ROOT=%{_pkgrootdir} \
101 APACHE_MODULES=%{_pkglibdir} \
102 APACHE_DOC_ROOT=%{htdocsdir} \
103 MOD_PAGESPEED_FILE_ROOT=%{cachedir} \
107 install -d $RPM_BUILD_ROOT{%{_pkglibdir},%{_sysconfdir}}
108 install -p mod_%{mod_name}.so $RPM_BUILD_ROOT%{_pkglibdir}
109 install -d $RPM_BUILD_ROOT%{cachedir}/{cache,files}
110 cat > $RPM_BUILD_ROOT%{_sysconfdir}/90_mod_%{mod_name}.conf <<EOF
111 LoadModule %{mod_name}_module modules/mod_%{mod_name}.so
113 $(cat pagespeed.conf)
117 rm -rf $RPM_BUILD_ROOT
120 %service -q httpd restart
123 if [ "$1" = "0" ]; then
124 %service -q httpd restart
128 %defattr(644,root,root,755)
129 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*_mod_%{mod_name}.conf
130 %attr(755,root,root) %{_pkglibdir}/mod_%{mod_name}.so
132 %dir %attr(710,root,http) %{cachedir}
133 %dir %attr(770,root,http) %{cachedir}/cache
134 %dir %attr(770,root,http) %{cachedir}/files