]> git.pld-linux.org Git - packages/apache-mod_pagespeed.git/blob - apache-mod_pagespeed.spec
bb4915321200cb883be0d115aba86ed3d3bd45c7
[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 # - relase notes: https://developers.google.com/speed/pagespeed/module/release_notes
7 # - http://code.google.com/p/modpagespeed/wiki/HowToBuild
8 # - http://wiki.mediatemple.net/w/(dv)_HOWTO:_Install_mod_pagespeed
9 # TODO
10 # - run unit tests
11 # third_party libraries:
12 # - apr - using system apr package
13 # - aprutil - using system apr-util, but from this repo modified apr_memcache2.c
14 # - gflags - system package may work
15 # - giflib - 4.1.6, no local modifications
16 # - google-sparsehash
17 # - httpd, httpd24 - using system apache-devel
18 # - icu - using system icu
19 # - jsoncpp - no local changes
20 # - libjpeg_turbo - 1.2.80 with chromium changes (but system lib should be fine)
21 # - libpng - no local changes
22 # - libwebp - 0.4.0, irrelevant local changes
23 # - optipng - 0.7.4, local changes: only the opngreduc component of optipng is included.
24 # - protobuf - should be possible to use full protobuf (not lite) to gain same functionality
25 # - re2 - should be possible to use system re2
26 # - serf - 0.7.2 bunch of google fixes
27 # - zlib - 1.2.5, no local changes
28 #
29 # third_party/chromium/src/base/third_party:
30 # - nspr - should be possible to use system lib
31 # - dmg_fp
32 # - dynamic_annotations
33 # - icu - not icu lib, but two files only
34 # - valgrind
35 #
36 # could be possible to use system libs, not packaged in pld:
37 # - base64
38 # - chromium
39 # - chromium_deps
40 # - css_parser
41 # - domain_registry_provider
42 # - instaweb
43 # - mod_spdy
44 # - modp_b64
45 # - rdestl
46
47 %define         mod_name        pagespeed
48 %define         apxs            %{_sbindir}/apxs
49 Summary:        Apache module for rewriting web pages to reduce latency and bandwidth
50 Name:           apache-mod_%{mod_name}
51 # beta: 1.9.32.x-beta
52 # stable: 1.8.31.x
53 Version:        1.8.31.6
54 Release:        0.29
55 License:        Apache v2.0
56 Group:          Networking/Daemons/HTTP
57 Source0:        modpagespeed-%{version}.tar.xz
58 # Source0-md5:  ab144d1d524ce60db44c4dfd6f3f8ef3
59 Source1:        get-source.sh
60 Source2:        gclient.conf
61 Patch0:         system-libs.patch
62 Patch2:         bug-632.patch
63 Patch4:         no-dev-stdout.patch
64 Patch5:         apache24-config.patch
65 URL:            https://developers.google.com/speed/pagespeed/module
66 BuildRequires:  %{apxs}
67 BuildRequires:  apache-devel >= 2.2
68 BuildRequires:  bash
69 BuildRequires:  glib2-devel
70 BuildRequires:  gperf
71 BuildRequires:  libicu-devel
72 BuildRequires:  libselinux-devel
73 BuildRequires:  libstdc++-devel >= 5:4.1
74 BuildRequires:  opencv-devel >= 2.3.1
75 BuildRequires:  openssl-devel
76 BuildRequires:  pkgconfig
77 BuildRequires:  python-devel >= 1:2.6
78 BuildRequires:  yasm
79 # This version of gyp is new enough that it knows to use make for Linux 3.x
80 # and FreeBSD, but old enough that 'type': 'settings' works and
81 # LINKER_SUPPORTS_ICF hasn't been removed yet.
82 BuildRequires:  python-gyp >= 0.1-0.svn1602.1
83 BuildRequires:  rpmbuild(macros) >= 1.268
84 BuildRequires:  tar >= 1:1.22
85 BuildRequires:  util-linux
86 BuildRequires:  xz
87 BuildRequires:  zlib-devel
88 Requires:       apache(modules-api) = %apache_modules_api
89 Requires:       apache-mod_authz_host
90 Requires:       apache-mod_headers
91 Suggests:       apache-mod_deflate
92 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
93
94 %define         _pkglibdir      %(%{apxs} -q LIBEXECDIR 2>/dev/null)
95 %define         _pkgrootdir     %(%{apxs} -q SYSCONFDIR 2>/dev/null)
96 %define         _sysconfdir     %{_pkgrootdir}/conf.d
97 %define         htdocsdir       %(%{apxs} -q htdocsdir 2>/dev/null)
98 %define         cachedir        %(%{apxs} -q proxycachedir 2>/dev/null)/mod_%{mod_name}
99
100 %description
101 mod_pagespeed automates the application of those rules in an Apache
102 server. HTML, CSS, JavaScript, and images are changed dynamically
103 during the web serving process, so that the best practices recommended
104 by Page Speed can be used without having to change the way the web
105 site is maintained.
106
107 %prep
108 %setup -q -n modpagespeed-%{version}
109 %patch0 -p2
110 %patch2 -p1
111 %patch4 -p1
112 %patch5 -p1
113
114 rm -r third_party/icu/source
115 rm -r third_party/icu/genfiles
116 install -d third_party/icu/source/{common,i18n}
117 ln -s %{_includedir}/unicode third_party/icu/source/i18n/unicode
118 ln -s %{_includedir}/unicode third_party/icu/source/common/unicode
119
120 %build
121 # re-gen makefiles
122 CC="%{__cc}" \
123 CXX="%{__cxx}" \
124 %{__python} build/gyp_chromium \
125         --format=make \
126         --depth=. \
127         build/all.gyp \
128         -Duse_openssl=1 \
129         -Duse_system_apache_dev=1 \
130         -Duse_system_icu=1 \
131         -Duse_system_libjpeg=1 \
132         -Duse_system_libpng=1 \
133         -Duse_system_opencv=1 \
134         -Duse_system_openssl=1 \
135         -Duse_system_yasm=1 \
136         -Duse_system_zlib=1 \
137         -Dsystem_include_path_apr=%{_includedir}/apr \
138         -Dsystem_include_path_aprutil=%{_includedir}/apr-util \
139         -Dsystem_include_path_httpd=%{_includedir}/apache \
140         %{nil}
141
142 %{__make} mod_pagespeed js_minify css_minify_main \
143         BUILDTYPE=%{!?debug:Release}%{?debug:Debug} \
144         %{?with_verbose:V=1} \
145         CC="%{__cc}" \
146         CXX="%{__cxx}" \
147         CC.host="%{__cc}" \
148         CXX.host="%{__cxx}" \
149         LINK.host="%{__cxx}" \
150         CFLAGS="%{rpmcflags} %{rpmcppflags}" \
151         CXXFLAGS="%{rpmcxxflags} %{rpmcppflags}" \
152         %{nil}
153
154 %install
155 rm -rf $RPM_BUILD_ROOT
156 install -d $RPM_BUILD_ROOT{%{_pkglibdir},%{_sysconfdir},%{_bindir},%{cachedir}}
157
158 %{__make} -j1 -C install staging_except_module \
159         APACHE_ROOT=%{_pkgrootdir} \
160         APACHE_MODULES=modules \
161         APACHE_DOC_ROOT=%{htdocsdir} \
162         MOD_PAGESPEED_CACHE=%{cachedir} \
163         MOD_PAGESPEED_STATS_LOG=/var/log/httpd/mod_pagespeed_stats.log \
164         STAGING_DIR=staging
165
166 out=out/%{!?debug:Release}%{?debug:Debug}
167 install -p $out/libmod_%{mod_name}.so $RPM_BUILD_ROOT%{_pkglibdir}/mod_%{mod_name}.so
168 install -p $out/js_minify $RPM_BUILD_ROOT%{_bindir}/pagespeed_js_minify
169 install -p $out/css_minify_main $RPM_BUILD_ROOT%{_bindir}/pagespeed_css_minify
170
171 cd install/staging
172 cat > $RPM_BUILD_ROOT%{_sysconfdir}/90_mod_%{mod_name}.conf <<EOF
173 LoadModule %{mod_name}_module   modules/mod_%{mod_name}.so
174
175 $(cat pagespeed.conf)
176 EOF
177
178 cp -p pagespeed_libraries.conf $RPM_BUILD_ROOT%{_sysconfdir}/91_mod_%{mod_name}_libraries.conf
179
180 install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
181 cp -a mod_pagespeed_example/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
182
183 %clean
184 rm -rf $RPM_BUILD_ROOT
185
186 %post
187 %service -q httpd restart
188
189 %postun
190 if [ "$1" = "0" ]; then
191         %service -q httpd restart
192 fi
193
194 %files
195 %defattr(644,root,root,755)
196 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*_mod_%{mod_name}.conf
197 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*_mod_%{mod_name}_libraries.conf
198 %attr(755,root,root) %{_bindir}/pagespeed_css_minify
199 %attr(755,root,root) %{_bindir}/pagespeed_js_minify
200 %attr(755,root,root) %{_pkglibdir}/mod_%{mod_name}.so
201 %{_examplesdir}/%{name}-%{version}
202 %dir %attr(770,root,http) %{cachedir}
This page took 0.057615 seconds and 2 git commands to generate.