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