]> git.pld-linux.org Git - packages/apache-mod_pagespeed.git/blob - apache-mod_pagespeed.spec
31103cb0ac0604e00c21363c8469ffd09af4c211
[packages/apache-mod_pagespeed.git] / apache-mod_pagespeed.spec
1 #
2 # Conditional build:
3 %bcond_without  verbose         # verbose build (V=1)
4
5 # NOTE
6 # - http://code.google.com/p/modpagespeed/wiki/HowToBuild
7 # - http://wiki.mediatemple.net/w/(dv)_HOWTO:_Install_mod_pagespeed
8 # TODO
9 # - add unit tests running
10 # - possible sysdeps (uses release tags)
11 #  "serf_src": "http://serf.googlecode.com/svn/tags/0.3.1",
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",
14 #  protobuf_lite
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
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}
27 Version:        1.3.25.3
28 Release:        1
29 License:        Apache v2.0
30 Group:          Networking/Daemons/HTTP
31 Source0:        modpagespeed-%{version}.tar.xz
32 # Source0-md5:  7df9bf6b1aacec28d81b1678192652ca
33 Source1:        get-source.sh
34 Source2:        gclient.conf
35 Patch0:         system-libs.patch
36 Patch1:         gcc-headers.patch
37 Patch2:         bug-632.patch
38 URL:            https://developers.google.com/speed/pagespeed/
39 BuildRequires:  %{apxs}
40 BuildRequires:  apache-devel >= 2.2
41 BuildRequires:  glib2-devel
42 BuildRequires:  gperf
43 BuildRequires:  libjpeg-devel
44 BuildRequires:  libselinux-devel
45 BuildRequires:  libstdc++-devel >= 5:4.1
46 BuildRequires:  opencv-devel >= 2.3.1
47 BuildRequires:  openssl-devel
48 BuildRequires:  pkgconfig
49 BuildRequires:  python-devel >= 1:2.6
50 # This version of gyp is new enough that it knows to use make for Linux 3.x
51 # and FreeBSD, but old enough that 'type': 'settings' works and
52 # LINKER_SUPPORTS_ICF hasn't been removed yet.
53 BuildRequires:  python-gyp >= 1-1175
54 BuildRequires:  rpmbuild(macros) >= 1.268
55 BuildRequires:  tar >= 1:1.22
56 BuildRequires:  util-linux
57 BuildRequires:  xz
58 BuildRequires:  zlib-devel
59 # gcc4 might be installed, but not current __cc
60 %if "%(echo %{cc_version} | cut -d. -f1,2)" < "4.0"
61 BuildRequires:  __cc >= 4.0
62 %endif
63 Requires:       apache(modules-api) = %apache_modules_api
64 Requires:       apache-mod_authz_host
65 Requires:       apache-mod_headers
66 Suggests:       apache-mod_deflate
67 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
68
69 %define         _pkglibdir      %(%{apxs} -q LIBEXECDIR 2>/dev/null)
70 %define         _pkgrootdir     %(%{apxs} -q SYSCONFDIR 2>/dev/null)
71 %define         _sysconfdir     %{_pkgrootdir}/conf.d
72 %define         htdocsdir       %(%{apxs} -q htdocsdir 2>/dev/null)
73 %define         cachedir        %(%{apxs} -q proxycachedir 2>/dev/null)/mod_%{mod_name}
74
75 %description
76 mod_pagespeed automates the application of those rules in an Apache
77 server. HTML, CSS, JavaScript, and images are changed dynamically
78 during the web serving process, so that the best practices recommended
79 by Page Speed can be used without having to change the way the web
80 site is maintained.
81
82 %prep
83 %setup -q -n modpagespeed-%{version}
84 %patch0 -p2
85 %patch1 -p2
86 %patch2 -p2
87
88 %build
89 # re-gen makefiles
90 CC="%{__cc}" \
91 CXX="%{__cxx}" \
92 %{__python} build/gyp_chromium \
93         --format=make \
94         --depth=. \
95         build/all.gyp \
96         -Duse_openssl=1 \
97         -Duse_system_apache_dev=1 \
98         -Duse_system_libjpeg=1 \
99         -Duse_system_libpng=1 \
100         -Duse_system_opencv=1 \
101         -Duse_system_zlib=1 \
102         -Dsystem_include_path_apr=%{_includedir}/apr \
103         -Dsystem_include_path_aprutil=%{_includedir}/apr-util \
104         -Dsystem_include_path_httpd=%{_includedir}/apache \
105         %{nil}
106
107 %{__make} mod_pagespeed js_minify css_minify_main \
108         BUILDTYPE=%{!?debug:Release}%{?debug:Debug} \
109         %{?with_verbose:V=1} \
110         CC="%{__cc}" \
111         CXX="%{__cxx}" \
112         CC.host="%{__cc}" \
113         CXX.host="%{__cxx}" \
114         LINK.host="%{__cxx}" \
115         CFLAGS="%{rpmcflags} %{rpmcppflags}" \
116         CXXFLAGS="%{rpmcxxflags} %{rpmcppflags}" \
117         %{nil}
118
119 %install
120 rm -rf $RPM_BUILD_ROOT
121 install -d $RPM_BUILD_ROOT{%{_pkglibdir},%{_sysconfdir},%{_bindir},%{cachedir}}
122
123 %{__make} -j1 -C install staging_except_module \
124         APACHE_ROOT=%{_pkgrootdir} \
125         APACHE_MODULES=modules \
126         APACHE_DOC_ROOT=%{htdocsdir} \
127         MOD_PAGESPEED_CACHE=%{cachedir} \
128         MOD_PAGESPEED_STATS_LOG=/var/log/httpd/mod_pagespeed_stats.log \
129         STAGING_DIR=staging
130
131 out=out/%{!?debug:Release}%{?debug:Debug}
132 install -p $out/libmod_%{mod_name}.so $RPM_BUILD_ROOT%{_pkglibdir}/mod_%{mod_name}.so
133 install -p $out/js_minify $RPM_BUILD_ROOT%{_bindir}/pagespeed_js_minify
134 install -p $out/css_minify_main $RPM_BUILD_ROOT%{_bindir}/pagespeed_css_minify
135
136 cd install/staging
137 cat > $RPM_BUILD_ROOT%{_sysconfdir}/90_mod_%{mod_name}.conf <<EOF
138 LoadModule %{mod_name}_module   modules/mod_%{mod_name}.so
139
140 $(cat pagespeed.conf)
141 EOF
142
143 cp -p pagespeed_libraries.conf $RPM_BUILD_ROOT%{_sysconfdir}/91_mod_%{mod_name}_libraries.conf
144
145 install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
146 cp -a mod_pagespeed_example/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
147
148 %clean
149 rm -rf $RPM_BUILD_ROOT
150
151 %post
152 %service -q httpd restart
153
154 %postun
155 if [ "$1" = "0" ]; then
156         %service -q httpd restart
157 fi
158
159 %files
160 %defattr(644,root,root,755)
161 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*_mod_%{mod_name}.conf
162 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*_mod_%{mod_name}_libraries.conf
163 %attr(755,root,root) %{_bindir}/pagespeed_css_minify
164 %attr(755,root,root) %{_bindir}/pagespeed_js_minify
165 %attr(755,root,root) %{_pkglibdir}/mod_%{mod_name}.so
166 %{_examplesdir}/%{name}-%{version}
167 %dir %attr(770,root,http) %{cachedir}
This page took 0.073347 seconds and 2 git commands to generate.