]>
Commit | Line | Data |
---|---|---|
757b3ba5 ER |
1 | # |
2 | # Conditional build: | |
42a31ab3 | 3 | %bcond_without verbose # verbose build (V=1) |
757b3ba5 | 4 | |
b6a5d8d0 | 5 | # NOTE |
757b3ba5 | 6 | # - http://code.google.com/p/modpagespeed/wiki/HowToBuild |
eb743e9a | 7 | # - http://wiki.mediatemple.net/w/(dv)_HOWTO:_Install_mod_pagespeed |
b6a5d8d0 | 8 | # TODO |
757b3ba5 | 9 | # - add unit tests running |
b6a5d8d0 ER |
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 | |
55f3a9d4 | 15 | # http://pastebin.com/Eu88BPSQ |
b6a5d8d0 ER |
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 | |
42a31ab3 | 23 | # - use only source for modpagespeed if system headers are used (remove copies from tarball) |
b6a5d8d0 ER |
24 | # - possible sysdeps (uses release tags) |
25 | # "serf_src": "http://serf.googlecode.com/svn/tags/0.3.1", | |
b6a5d8d0 | 26 | # "apache_httpd_src": "http://svn.apache.org/repos/asf/httpd/httpd/tags/2.2.15", |
b6a5d8d0 ER |
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", | |
b74b29a5 | 29 | # protobuf_lite |
24f1647c ER |
30 | |
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,')} | |
36 | %endif | |
37 | ||
08710a2f ER |
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} | |
b74b29a5 | 42 | Version: 0.10.22.4 |
42a31ab3 | 43 | Release: 0.7 |
08710a2f ER |
44 | License: Apache v2.0 |
45 | Group: Networking/Daemons/HTTP | |
757b3ba5 | 46 | Source0: modpagespeed-%{version}.tar.bz2 |
42a31ab3 | 47 | # Source0-md5: 9c9a8b091ee8d37253ee35878c3390e6 |
b74b29a5 | 48 | Source1: get-source.sh |
42a31ab3 ER |
49 | Patch0: system-libs.patch |
50 | Patch1: gcc-headers.patch | |
b74b29a5 | 51 | URL: https://developers.google.com/speed/pagespeed/ |
08710a2f ER |
52 | BuildRequires: %{apxs} |
53 | BuildRequires: apache-devel >= 2.2 | |
42a31ab3 ER |
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 | |
b74b29a5 | 65 | BuildRequires: libstdc++-devel >= 5:4.1 |
42a31ab3 ER |
66 | BuildRequires: opencv-devel |
67 | BuildRequires: openssl-devel | |
757b3ba5 | 68 | BuildRequires: python-devel >= 1:2.6 |
08710a2f | 69 | BuildRequires: rpmbuild(macros) >= 1.268 |
42a31ab3 ER |
70 | BuildRequires: xorg-lib-libX11-devel |
71 | BuildRequires: xorg-lib-libXext-devel | |
72 | BuildRequires: xorg-lib-libXi-devel | |
73 | BuildRequires: zlib-devel | |
24f1647c ER |
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 | |
77 | %endif | |
08710a2f | 78 | Requires: apache(modules-api) = %apache_modules_api |
e5171f2e | 79 | Requires: apache-mod_authz_host |
b6a5d8d0 | 80 | Suggests: apache-mod_deflate |
08710a2f ER |
81 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
82 | ||
83 | %define _pkglibdir %(%{apxs} -q LIBEXECDIR 2>/dev/null) | |
06daee42 ER |
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} | |
08710a2f ER |
88 | |
89 | %description | |
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 | |
94 | site is maintained. | |
95 | ||
96 | %prep | |
e62ba6cb | 97 | %setup -q -n modpagespeed |
42a31ab3 ER |
98 | %patch0 -p1 |
99 | %patch1 -p1 | |
08710a2f ER |
100 | |
101 | %build | |
eb743e9a | 102 | # re-gen makefiles |
e62ba6cb ER |
103 | cd src |
104 | CC="%{__cc}" \ | |
105 | CXX="%{__cxx}" \ | |
42a31ab3 ER |
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 \ | |
110 | -Duse_openssl=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 \ | |
116 | -Duse_ibus=1 \ | |
117 | %{nil} | |
118 | ||
e62ba6cb | 119 | cd .. |
eb743e9a | 120 | |
e62ba6cb | 121 | # makefile wrapper so we could just invoke "make" from shell |
08710a2f ER |
122 | cat > Makefile <<'EOF' |
123 | default: | |
124 | $(MAKE) -C src \ | |
125 | BUILDTYPE=%{!?debug:Release}%{?debug:Debug} \ | |
126 | %{?with_verbose:V=1} \ | |
127 | CC="%{__cc}" \ | |
128 | CXX="%{__cxx}" \ | |
129 | CC.host="%{__cc}" \ | |
130 | CXX.host="%{__cxx}" \ | |
131 | LINK.host="%{__cxx}" \ | |
132 | CFLAGS="%{rpmcflags} %{rpmcppflags}" \ | |
133 | CXXFLAGS="%{rpmcxxflags} %{rpmcppflags}" \ | |
42a31ab3 | 134 | $(MAKEFLAGS) \ |
08710a2f ER |
135 | EOF |
136 | %{__make} | |
137 | ||
42a31ab3 ER |
138 | # install.gyp needs fixing, not to install ap24.so, for now duplicate |
139 | ln -f src/out/Release/libmod_pagespeed{,_ap24}.so | |
140 | ||
08710a2f ER |
141 | %install |
142 | rm -rf $RPM_BUILD_ROOT | |
06daee42 ER |
143 | %{__make} -j1 -C src/install staging \ |
144 | HOSTNAME=localhost \ | |
145 | APACHE_ROOT=%{_pkgrootdir} \ | |
146 | APACHE_MODULES=%{_pkglibdir} \ | |
147 | APACHE_DOC_ROOT=%{htdocsdir} \ | |
148 | MOD_PAGESPEED_FILE_ROOT=%{cachedir} \ | |
149 | STAGING_DIR=staging | |
150 | ||
dbd6833d | 151 | cd src/install/staging |
08710a2f ER |
152 | install -d $RPM_BUILD_ROOT{%{_pkglibdir},%{_sysconfdir}} |
153 | install -p mod_%{mod_name}.so $RPM_BUILD_ROOT%{_pkglibdir} | |
06daee42 ER |
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 | |
157 | ||
158 | $(cat pagespeed.conf) | |
159 | EOF | |
08710a2f ER |
160 | |
161 | %clean | |
162 | rm -rf $RPM_BUILD_ROOT | |
163 | ||
164 | %post | |
165 | %service -q httpd restart | |
166 | ||
167 | %postun | |
168 | if [ "$1" = "0" ]; then | |
169 | %service -q httpd restart | |
170 | fi | |
171 | ||
172 | %files | |
173 | %defattr(644,root,root,755) | |
08710a2f | 174 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*_mod_%{mod_name}.conf |
b6a5d8d0 | 175 | %attr(755,root,root) %{_pkglibdir}/mod_%{mod_name}.so |
06daee42 ER |
176 | |
177 | %dir %attr(710,root,http) %{cachedir} | |
178 | %dir %attr(770,root,http) %{cachedir}/cache | |
179 | %dir %attr(770,root,http) %{cachedir}/files |