]>
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 | # - possible sysdeps (uses release tags) |
11 | # "serf_src": "http://serf.googlecode.com/svn/tags/0.3.1", | |
b6a5d8d0 ER |
12 | # "gflags_root": "http://google-gflags.googlecode.com/svn/tags/gflags-1.3/src", |
13 | # "google_sparsehash_root": "http://google-sparsehash.googlecode.com/svn/tags/sparsehash-1.8.1/src", | |
b74b29a5 | 14 | # protobuf_lite |
24f1647c ER |
15 | |
16 | %if "%{pld_release}" == "ac" | |
17 | # add suffix, but allow ccache, etc in ~/.rpmmacros | |
18 | %{expand:%%define __cc %(echo '%__cc' | sed -e 's,-gcc,-gcc4,')} | |
19 | %{expand:%%define __cxx %(echo '%__cxx' | sed -e 's,-g++,-g++4,')} | |
20 | %{expand:%%define __cpp %(echo '%__cpp' | sed -e 's,-gcc,-gcc4,')} | |
21 | %endif | |
22 | ||
08710a2f ER |
23 | %define mod_name pagespeed |
24 | %define apxs %{_sbindir}/apxs | |
25 | Summary: Apache module for rewriting web pages to reduce latency and bandwidth | |
26 | Name: apache-mod_%{mod_name} | |
5bdfa704 ER |
27 | Version: 1.3.25.3 |
28 | Release: 0.3 | |
08710a2f ER |
29 | License: Apache v2.0 |
30 | Group: Networking/Daemons/HTTP | |
4623c72a | 31 | Source0: modpagespeed-%{version}.tar.xz |
5bdfa704 | 32 | # Source0-md5: 7df9bf6b1aacec28d81b1678192652ca |
b74b29a5 | 33 | Source1: get-source.sh |
42a31ab3 ER |
34 | Patch0: system-libs.patch |
35 | Patch1: gcc-headers.patch | |
b74b29a5 | 36 | URL: https://developers.google.com/speed/pagespeed/ |
08710a2f ER |
37 | BuildRequires: %{apxs} |
38 | BuildRequires: apache-devel >= 2.2 | |
42a31ab3 | 39 | BuildRequires: glib2-devel |
3f27b998 | 40 | BuildRequires: gperf |
42a31ab3 | 41 | BuildRequires: libjpeg-devel |
42a31ab3 | 42 | BuildRequires: libselinux-devel |
b74b29a5 | 43 | BuildRequires: libstdc++-devel >= 5:4.1 |
4623c72a | 44 | BuildRequires: opencv-devel >= 2.3.1 |
42a31ab3 | 45 | BuildRequires: openssl-devel |
3f27b998 | 46 | BuildRequires: pkgconfig |
757b3ba5 | 47 | BuildRequires: python-devel >= 1:2.6 |
4623c72a ER |
48 | # This version of gyp is new enough that it knows to use make for Linux 3.x |
49 | # and FreeBSD, but old enough that 'type': 'settings' works and | |
50 | # LINKER_SUPPORTS_ICF hasn't been removed yet. | |
51 | BuildRequires: python-gyp >= 1-1175 | |
08710a2f | 52 | BuildRequires: rpmbuild(macros) >= 1.268 |
4623c72a | 53 | BuildRequires: tar >= 1:1.22 |
2ddcd200 | 54 | BuildRequires: util-linux |
4623c72a | 55 | BuildRequires: xz |
42a31ab3 | 56 | BuildRequires: zlib-devel |
24f1647c ER |
57 | # gcc4 might be installed, but not current __cc |
58 | %if "%(echo %{cc_version} | cut -d. -f1,2)" < "4.0" | |
59 | BuildRequires: __cc >= 4.0 | |
60 | %endif | |
08710a2f | 61 | Requires: apache(modules-api) = %apache_modules_api |
e5171f2e | 62 | Requires: apache-mod_authz_host |
3f27b998 | 63 | Requires: apache-mod_headers |
b6a5d8d0 | 64 | Suggests: apache-mod_deflate |
08710a2f ER |
65 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
66 | ||
67 | %define _pkglibdir %(%{apxs} -q LIBEXECDIR 2>/dev/null) | |
06daee42 ER |
68 | %define _pkgrootdir %(%{apxs} -q SYSCONFDIR 2>/dev/null) |
69 | %define _sysconfdir %{_pkgrootdir}/conf.d | |
70 | %define htdocsdir %(%{apxs} -q htdocsdir 2>/dev/null) | |
71 | %define cachedir %(%{apxs} -q proxycachedir 2>/dev/null)/mod_%{mod_name} | |
08710a2f ER |
72 | |
73 | %description | |
74 | mod_pagespeed automates the application of those rules in an Apache | |
75 | server. HTML, CSS, JavaScript, and images are changed dynamically | |
76 | during the web serving process, so that the best practices recommended | |
77 | by Page Speed can be used without having to change the way the web | |
78 | site is maintained. | |
79 | ||
80 | %prep | |
5bdfa704 ER |
81 | %setup -q -n modpagespeed-%{version} |
82 | %patch0 -p2 | |
83 | %patch1 -p2 | |
08710a2f ER |
84 | |
85 | %build | |
eb743e9a | 86 | # re-gen makefiles |
e62ba6cb ER |
87 | CC="%{__cc}" \ |
88 | CXX="%{__cxx}" \ | |
5bdfa704 ER |
89 | %{__python} build/gyp_chromium \ |
90 | --format=make \ | |
91 | --depth=. \ | |
92 | build/all.gyp \ | |
42a31ab3 ER |
93 | -Duse_openssl=1 \ |
94 | -Duse_system_apache_dev=1 \ | |
95 | -Duse_system_libjpeg=1 \ | |
96 | -Duse_system_libpng=1 \ | |
97 | -Duse_system_opencv=1 \ | |
98 | -Duse_system_zlib=1 \ | |
b2f50394 ER |
99 | -Dsystem_include_path_apr=%{_includedir}/apr \ |
100 | -Dsystem_include_path_aprutil=%{_includedir}/apr-util \ | |
101 | -Dsystem_include_path_httpd=%{_includedir}/apache \ | |
42a31ab3 ER |
102 | %{nil} |
103 | ||
5bdfa704 | 104 | %{__make} mod_pagespeed \ |
08710a2f ER |
105 | BUILDTYPE=%{!?debug:Release}%{?debug:Debug} \ |
106 | %{?with_verbose:V=1} \ | |
107 | CC="%{__cc}" \ | |
108 | CXX="%{__cxx}" \ | |
109 | CC.host="%{__cc}" \ | |
110 | CXX.host="%{__cxx}" \ | |
111 | LINK.host="%{__cxx}" \ | |
112 | CFLAGS="%{rpmcflags} %{rpmcppflags}" \ | |
113 | CXXFLAGS="%{rpmcxxflags} %{rpmcppflags}" \ | |
5bdfa704 | 114 | %{nil} |
08710a2f ER |
115 | |
116 | %install | |
117 | rm -rf $RPM_BUILD_ROOT | |
3f27b998 | 118 | install -d $RPM_BUILD_ROOT{%{_pkglibdir},%{_sysconfdir},%{cachedir}/{cache,files}} |
5bdfa704 | 119 | %{__make} -j1 -C install staging_except_module \ |
06daee42 | 120 | APACHE_ROOT=%{_pkgrootdir} \ |
3f27b998 | 121 | APACHE_MODULES=modules \ |
06daee42 | 122 | APACHE_DOC_ROOT=%{htdocsdir} \ |
5bdfa704 ER |
123 | MOD_PAGESPEED_CACHE=%{cachedir} \ |
124 | MOD_PAGESPEED_STATS_LOG=/var/log/httpd/mod_pagespeed_stats.log \ | |
06daee42 ER |
125 | STAGING_DIR=staging |
126 | ||
5bdfa704 ER |
127 | install -p out/Release/libmod_%{mod_name}.so $RPM_BUILD_ROOT%{_pkglibdir}/mod_%{mod_name}.so |
128 | cd install/staging | |
06daee42 ER |
129 | cat > $RPM_BUILD_ROOT%{_sysconfdir}/90_mod_%{mod_name}.conf <<EOF |
130 | LoadModule %{mod_name}_module modules/mod_%{mod_name}.so | |
131 | ||
132 | $(cat pagespeed.conf) | |
133 | EOF | |
08710a2f | 134 | |
3f27b998 ER |
135 | install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} |
136 | cp -a mod_pagespeed_example/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} | |
137 | ||
08710a2f ER |
138 | %clean |
139 | rm -rf $RPM_BUILD_ROOT | |
140 | ||
141 | %post | |
142 | %service -q httpd restart | |
143 | ||
144 | %postun | |
145 | if [ "$1" = "0" ]; then | |
146 | %service -q httpd restart | |
147 | fi | |
148 | ||
149 | %files | |
150 | %defattr(644,root,root,755) | |
08710a2f | 151 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*_mod_%{mod_name}.conf |
b6a5d8d0 | 152 | %attr(755,root,root) %{_pkglibdir}/mod_%{mod_name}.so |
3f27b998 | 153 | %{_examplesdir}/%{name}-%{version} |
06daee42 | 154 | |
5bdfa704 | 155 | %dir %attr(770,root,http) %{cachedir} |