]> git.pld-linux.org Git - packages/apache-mod_pagespeed.git/blob - apache-mod_pagespeed.spec
use gyp defines to correct include paths
[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:        0.10.22.7
28 Release:        2
29 License:        Apache v2.0
30 Group:          Networking/Daemons/HTTP
31 Source0:        modpagespeed-%{version}.tar.xz
32 # Source0-md5:  1c67625812d18899ce6a47da069c6043
33 Source1:        get-source.sh
34 Patch0:         system-libs.patch
35 Patch1:         gcc-headers.patch
36 URL:            https://developers.google.com/speed/pagespeed/
37 BuildRequires:  %{apxs}
38 BuildRequires:  apache-devel >= 2.2
39 BuildRequires:  glib2-devel
40 BuildRequires:  gperf
41 BuildRequires:  libjpeg-devel
42 BuildRequires:  libselinux-devel
43 BuildRequires:  libstdc++-devel >= 5:4.1
44 BuildRequires:  opencv-devel >= 2.3.1
45 BuildRequires:  openssl-devel
46 BuildRequires:  pkgconfig
47 BuildRequires:  python-devel >= 1:2.6
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
52 BuildRequires:  rpmbuild(macros) >= 1.268
53 BuildRequires:  tar >= 1:1.22
54 BuildRequires:  util-linux
55 BuildRequires:  xz
56 BuildRequires:  zlib-devel
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
61 Requires:       apache(modules-api) = %apache_modules_api
62 Requires:       apache-mod_authz_host
63 Requires:       apache-mod_headers
64 Suggests:       apache-mod_deflate
65 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
66
67 %define         _pkglibdir      %(%{apxs} -q LIBEXECDIR 2>/dev/null)
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}
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
81 %setup -q -n modpagespeed
82 %patch0 -p1
83 %patch1 -p1
84
85 %build
86 # re-gen makefiles
87 cd src
88 CC="%{__cc}" \
89 CXX="%{__cxx}" \
90 %{__python} build/gyp_chromium --format=make build/all.gyp \
91         -Duse_openssl=1 \
92         -Duse_system_apache_dev=1 \
93         -Duse_system_libjpeg=1 \
94         -Duse_system_libpng=1 \
95         -Duse_system_opencv=1 \
96         -Duse_system_zlib=1 \
97         -Dsystem_include_path_apr=%{_includedir}/apr \
98         -Dsystem_include_path_aprutil=%{_includedir}/apr-util \
99         -Dsystem_include_path_httpd=%{_includedir}/apache \
100         %{nil}
101
102 cd ..
103
104 # makefile wrapper so we could just invoke "make" from shell
105 cat > Makefile <<'EOF'
106 # target names from build/all.gyp
107 default:
108         $(MAKE) -C src mod_pagespeed \
109         BUILDTYPE=%{!?debug:Release}%{?debug:Debug} \
110         %{?with_verbose:V=1} \
111         CC="%{__cc}" \
112         CXX="%{__cxx}" \
113         CC.host="%{__cc}" \
114         CXX.host="%{__cxx}" \
115         LINK.host="%{__cxx}" \
116         CFLAGS="%{rpmcflags} %{rpmcppflags}" \
117         CXXFLAGS="%{rpmcxxflags} %{rpmcppflags}" \
118         $(MAKEFLAGS) \
119 EOF
120 %{__make}
121
122 %install
123 rm -rf $RPM_BUILD_ROOT
124 install -d $RPM_BUILD_ROOT{%{_pkglibdir},%{_sysconfdir},%{cachedir}/{cache,files}}
125 %{__make} -j1 -C src/install staging_except_module \
126         HOSTNAME=localhost \
127         APACHE_ROOT=%{_pkgrootdir} \
128         APACHE_MODULES=modules \
129         APACHE_DOC_ROOT=%{htdocsdir} \
130         MOD_PAGESPEED_FILE_ROOT=%{cachedir} \
131         STAGING_DIR=staging
132
133 install -p src/out/Release/libmod_%{mod_name}.so $RPM_BUILD_ROOT%{_pkglibdir}/mod_%{mod_name}.so
134 cd src/install/staging
135 cat > $RPM_BUILD_ROOT%{_sysconfdir}/90_mod_%{mod_name}.conf <<EOF
136 LoadModule %{mod_name}_module   modules/mod_%{mod_name}.so
137
138 $(cat pagespeed.conf)
139 EOF
140
141 install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
142 cp -a mod_pagespeed_example/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
143
144 %clean
145 rm -rf $RPM_BUILD_ROOT
146
147 %post
148 %service -q httpd restart
149
150 %postun
151 if [ "$1" = "0" ]; then
152         %service -q httpd restart
153 fi
154
155 %files
156 %defattr(644,root,root,755)
157 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*_mod_%{mod_name}.conf
158 %attr(755,root,root) %{_pkglibdir}/mod_%{mod_name}.so
159 %{_examplesdir}/%{name}-%{version}
160
161 %dir %attr(710,root,http) %{cachedir}
162 %dir %attr(770,root,http) %{cachedir}/cache
163 %dir %attr(770,root,http) %{cachedir}/files
This page took 0.120422 seconds and 4 git commands to generate.