# - use make < 3.82 (from th-obsolete) to hack on code, because 3.82
# invalidates built objects and it's annoying to wait if all is recompiled
# each time you invoke make
+# - http://wiki.mediatemple.net/w/(dv)_HOWTO:_Install_mod_pagespeed
# TODO
# - c++ errors on 64bit/32bit gcc 4.5.1-4:
# /usr/include/c++/4.5.1/bits/stl_map.h:87:5: instantiated from here
# /usr/include/c++/4.5.1/bits/stl_pair.h:77:11: error: ‘std::pair<_T1, _T2>::second’ has incomplete type
# ./net/instaweb/util/public/cache_interface.h:28:7: error: forward declaration of ‘struct net_instaweb::SharedString’
# make[1]: *** [out/Release/obj.target/mod_pagespeed_test/net/instaweb/util/cache_fetcher_test.o] Error 1
+# http://pastebin.com/Eu88BPSQ
# - sizeof(apr_int32_t) == sizeof(apr_int64_t) on 32bit (!?!):
# third_party/apache/apr/src/strings/apr_snprintf.c: In function 'conv_os_thread_t':
# third_party/apache/apr/src/strings/apr_snprintf.c:500:5: error: duplicate case value
# "opencv_src": "https://code.ros.org/svn/opencv/tags/2.1",
# "gflags_root": "http://google-gflags.googlecode.com/svn/tags/gflags-1.3/src",
# "google_sparsehash_root": "http://google-sparsehash.googlecode.com/svn/tags/sparsehash-1.8.1/src",
-
%define svndate 20101104
-%define rel 0.1
%define mod_name pagespeed
%define apxs %{_sbindir}/apxs
Summary: Apache module for rewriting web pages to reduce latency and bandwidth
Name: apache-mod_%{mod_name}
Version: 0.9.0.0
-Release: 0.1
+Release: 0.3
License: Apache v2.0
Group: Networking/Daemons/HTTP
-# svn co http://src.chromium.org/svn/trunk/tools/depot_tools
+# wget -c http://src.chromium.org/svn/trunk/tools/depot_tools.tar.gz
+# test -d depot_tools || tar xzf depot_tools.tar.gz
# install -d modpagespeed
# cd modpagespeed
-# ../depot_tools/gclient config http://modpagespeed.googlecode.com/svn/trunk/src
+# test -f .gclient || ../depot_tools/gclient config http://modpagespeed.googlecode.com/svn/trunk/src
# ../depot_tools/gclient sync
-# Populate the LASTCHANGE file template as we no longer have the VCS files at this point
+# Populate the LASTCHANGE file template as we will not include VCS info in tarball
# (cd src/build && svnversion > LASTCHANGE.in)
# cd ..
# tar -cjf modpagespeed-$(date +%Y%m%d).tar.bz2 --exclude-vcs modpagespeed
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%define _pkglibdir %(%{apxs} -q LIBEXECDIR 2>/dev/null)
-%define _sysconfdir %(%{apxs} -q SYSCONFDIR 2>/dev/null)/conf.d
+%define _pkgrootdir %(%{apxs} -q SYSCONFDIR 2>/dev/null)
+%define _sysconfdir %{_pkgrootdir}/conf.d
+%define htdocsdir %(%{apxs} -q htdocsdir 2>/dev/null)
+%define cachedir %(%{apxs} -q proxycachedir 2>/dev/null)/mod_%{mod_name}
%description
mod_pagespeed automates the application of those rules in an Apache
%prep
%setup -q -n modpagespeed
-cat > apache.conf <<EOF
-LoadModule %{mod_name}_module modules/mod_%{mod_name}.so > apache.conf
-
-$(cat src/install/common/pagespeed.conf.template)
-EOF
-
%build
+# re-gen makefiles
+cd src
+CC="%{__cc}" \
+CXX="%{__cxx}" \
+%{__python} build/gyp_chromium --format=make build/all.gyp
+cd ..
+
+# makefile wrapper so we could just invoke "make" from shell
cat > Makefile <<'EOF'
default:
$(MAKE) -C src \
%install
rm -rf $RPM_BUILD_ROOT
+%{__make} -j1 -C src/install staging \
+ HOSTNAME=localhost \
+ APACHE_ROOT=%{_pkgrootdir} \
+ APACHE_MODULES=%{_pkglibdir} \
+ APACHE_DOC_ROOT=%{htdocsdir} \
+ MOD_PAGESPEED_FILE_ROOT=%{cachedir} \
+ STAGING_DIR=staging
+
+cd staging
install -d $RPM_BUILD_ROOT{%{_pkglibdir},%{_sysconfdir}}
install -p mod_%{mod_name}.so $RPM_BUILD_ROOT%{_pkglibdir}
-cp -a apache.conf $RPM_BUILD_ROOT%{_sysconfdir}/90_mod_%{mod_name}.conf
+install -d $RPM_BUILD_ROOT%{cachedir}/{cache,files}
+cat > $RPM_BUILD_ROOT%{_sysconfdir}/90_mod_%{mod_name}.conf <<EOF
+LoadModule %{mod_name}_module modules/mod_%{mod_name}.so
+
+$(cat pagespeed.conf)
+EOF
%clean
rm -rf $RPM_BUILD_ROOT
%defattr(644,root,root,755)
%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*_mod_%{mod_name}.conf
%attr(755,root,root) %{_pkglibdir}/mod_%{mod_name}.so
+
+%dir %attr(710,root,http) %{cachedir}
+%dir %attr(770,root,http) %{cachedir}/cache
+%dir %attr(770,root,http) %{cachedir}/files