]>
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 |
42a31ab3 | 10 | # - use only source for modpagespeed if system headers are used (remove copies from tarball) |
b6a5d8d0 ER |
11 | # - possible sysdeps (uses release tags) |
12 | # "serf_src": "http://serf.googlecode.com/svn/tags/0.3.1", | |
b6a5d8d0 ER |
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", | |
b74b29a5 | 15 | # protobuf_lite |
24f1647c ER |
16 | |
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,')} | |
22 | %endif | |
23 | ||
08710a2f ER |
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} | |
b74b29a5 | 28 | Version: 0.10.22.4 |
3f27b998 | 29 | Release: 0.9 |
08710a2f ER |
30 | License: Apache v2.0 |
31 | Group: Networking/Daemons/HTTP | |
757b3ba5 | 32 | Source0: modpagespeed-%{version}.tar.bz2 |
42a31ab3 | 33 | # Source0-md5: 9c9a8b091ee8d37253ee35878c3390e6 |
b74b29a5 | 34 | Source1: get-source.sh |
42a31ab3 ER |
35 | Patch0: system-libs.patch |
36 | Patch1: gcc-headers.patch | |
b74b29a5 | 37 | URL: https://developers.google.com/speed/pagespeed/ |
08710a2f ER |
38 | BuildRequires: %{apxs} |
39 | BuildRequires: apache-devel >= 2.2 | |
42a31ab3 ER |
40 | BuildRequires: dbus-glib-devel |
41 | BuildRequires: fontconfig-devel | |
42 | BuildRequires: freetype-devel | |
43 | BuildRequires: glib2-devel | |
3f27b998 | 44 | BuildRequires: gperf |
42a31ab3 | 45 | BuildRequires: gtk+2-devel |
42a31ab3 ER |
46 | BuildRequires: libgcrypt-devel |
47 | BuildRequires: libgnome-keyring-devel | |
48 | BuildRequires: libjpeg-devel | |
49 | BuildRequires: libpng-devel | |
50 | BuildRequires: libselinux-devel | |
b74b29a5 | 51 | BuildRequires: libstdc++-devel >= 5:4.1 |
42a31ab3 ER |
52 | BuildRequires: opencv-devel |
53 | BuildRequires: openssl-devel | |
3f27b998 | 54 | BuildRequires: pkgconfig |
757b3ba5 | 55 | BuildRequires: python-devel >= 1:2.6 |
08710a2f | 56 | BuildRequires: rpmbuild(macros) >= 1.268 |
42a31ab3 ER |
57 | BuildRequires: xorg-lib-libX11-devel |
58 | BuildRequires: xorg-lib-libXext-devel | |
59 | BuildRequires: xorg-lib-libXi-devel | |
60 | BuildRequires: zlib-devel | |
24f1647c ER |
61 | # gcc4 might be installed, but not current __cc |
62 | %if "%(echo %{cc_version} | cut -d. -f1,2)" < "4.0" | |
63 | BuildRequires: __cc >= 4.0 | |
64 | %endif | |
08710a2f | 65 | Requires: apache(modules-api) = %apache_modules_api |
e5171f2e | 66 | Requires: apache-mod_authz_host |
3f27b998 | 67 | Requires: apache-mod_headers |
b6a5d8d0 | 68 | Suggests: apache-mod_deflate |
08710a2f ER |
69 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
70 | ||
71 | %define _pkglibdir %(%{apxs} -q LIBEXECDIR 2>/dev/null) | |
06daee42 ER |
72 | %define _pkgrootdir %(%{apxs} -q SYSCONFDIR 2>/dev/null) |
73 | %define _sysconfdir %{_pkgrootdir}/conf.d | |
74 | %define htdocsdir %(%{apxs} -q htdocsdir 2>/dev/null) | |
75 | %define cachedir %(%{apxs} -q proxycachedir 2>/dev/null)/mod_%{mod_name} | |
08710a2f ER |
76 | |
77 | %description | |
78 | mod_pagespeed automates the application of those rules in an Apache | |
79 | server. HTML, CSS, JavaScript, and images are changed dynamically | |
80 | during the web serving process, so that the best practices recommended | |
81 | by Page Speed can be used without having to change the way the web | |
82 | site is maintained. | |
83 | ||
84 | %prep | |
e62ba6cb | 85 | %setup -q -n modpagespeed |
42a31ab3 ER |
86 | %patch0 -p1 |
87 | %patch1 -p1 | |
08710a2f ER |
88 | |
89 | %build | |
eb743e9a | 90 | # re-gen makefiles |
e62ba6cb ER |
91 | cd src |
92 | CC="%{__cc}" \ | |
93 | CXX="%{__cxx}" \ | |
42a31ab3 ER |
94 | %{__python} build/gyp_chromium --format=make build/all.gyp \ |
95 | -Dlinux_link_gsettings=1 \ | |
96 | -Dlinux_link_gnome_keyring=1 \ | |
97 | -Duse_gnome_keyring=1 \ | |
98 | -Duse_openssl=1 \ | |
99 | -Duse_system_apache_dev=1 \ | |
100 | -Duse_system_libjpeg=1 \ | |
101 | -Duse_system_libpng=1 \ | |
102 | -Duse_system_opencv=1 \ | |
103 | -Duse_system_zlib=1 \ | |
42a31ab3 ER |
104 | %{nil} |
105 | ||
e62ba6cb | 106 | cd .. |
eb743e9a | 107 | |
e62ba6cb | 108 | # makefile wrapper so we could just invoke "make" from shell |
08710a2f ER |
109 | cat > Makefile <<'EOF' |
110 | default: | |
111 | $(MAKE) -C src \ | |
112 | BUILDTYPE=%{!?debug:Release}%{?debug:Debug} \ | |
113 | %{?with_verbose:V=1} \ | |
114 | CC="%{__cc}" \ | |
115 | CXX="%{__cxx}" \ | |
116 | CC.host="%{__cc}" \ | |
117 | CXX.host="%{__cxx}" \ | |
118 | LINK.host="%{__cxx}" \ | |
119 | CFLAGS="%{rpmcflags} %{rpmcppflags}" \ | |
120 | CXXFLAGS="%{rpmcxxflags} %{rpmcppflags}" \ | |
42a31ab3 | 121 | $(MAKEFLAGS) \ |
08710a2f ER |
122 | EOF |
123 | %{__make} | |
124 | ||
125 | %install | |
126 | rm -rf $RPM_BUILD_ROOT | |
3f27b998 ER |
127 | install -d $RPM_BUILD_ROOT{%{_pkglibdir},%{_sysconfdir},%{cachedir}/{cache,files}} |
128 | %{__make} -j1 -C src/install staging_except_module \ | |
06daee42 ER |
129 | HOSTNAME=localhost \ |
130 | APACHE_ROOT=%{_pkgrootdir} \ | |
3f27b998 | 131 | APACHE_MODULES=modules \ |
06daee42 ER |
132 | APACHE_DOC_ROOT=%{htdocsdir} \ |
133 | MOD_PAGESPEED_FILE_ROOT=%{cachedir} \ | |
134 | STAGING_DIR=staging | |
135 | ||
3f27b998 | 136 | install -p src/out/Release/libmod_%{mod_name}.so $RPM_BUILD_ROOT%{_pkglibdir}/mod_%{mod_name}.so |
dbd6833d | 137 | cd src/install/staging |
06daee42 ER |
138 | cat > $RPM_BUILD_ROOT%{_sysconfdir}/90_mod_%{mod_name}.conf <<EOF |
139 | LoadModule %{mod_name}_module modules/mod_%{mod_name}.so | |
140 | ||
141 | $(cat pagespeed.conf) | |
142 | EOF | |
08710a2f | 143 | |
3f27b998 ER |
144 | install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} |
145 | cp -a mod_pagespeed_example/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} | |
146 | ||
08710a2f ER |
147 | %clean |
148 | rm -rf $RPM_BUILD_ROOT | |
149 | ||
150 | %post | |
151 | %service -q httpd restart | |
152 | ||
153 | %postun | |
154 | if [ "$1" = "0" ]; then | |
155 | %service -q httpd restart | |
156 | fi | |
157 | ||
158 | %files | |
159 | %defattr(644,root,root,755) | |
08710a2f | 160 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*_mod_%{mod_name}.conf |
b6a5d8d0 | 161 | %attr(755,root,root) %{_pkglibdir}/mod_%{mod_name}.so |
3f27b998 | 162 | %{_examplesdir}/%{name}-%{version} |
06daee42 ER |
163 | |
164 | %dir %attr(710,root,http) %{cachedir} | |
165 | %dir %attr(770,root,http) %{cachedir}/cache | |
166 | %dir %attr(770,root,http) %{cachedir}/files |