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