#
# Conditional build:
%bcond_without verbose # verbose build (V=1)
+%bcond_with sse2 # use SSE2 instructions
# NOTE
+# - relase notes: https://developers.google.com/speed/pagespeed/module/release_notes
# - http://code.google.com/p/modpagespeed/wiki/HowToBuild
# - http://wiki.mediatemple.net/w/(dv)_HOWTO:_Install_mod_pagespeed
# TODO
-# - add unit tests running
-# - possible sysdeps (uses release tags)
-# "serf_src": "http://serf.googlecode.com/svn/tags/0.3.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",
-# protobuf_lite
-
-%if "%{pld_release}" == "ac"
-# add suffix, but allow ccache, etc in ~/.rpmmacros
-%{expand:%%define __cc %(echo '%__cc' | sed -e 's,-gcc,-gcc4,')}
-%{expand:%%define __cxx %(echo '%__cxx' | sed -e 's,-g++,-g++4,')}
-%{expand:%%define __cpp %(echo '%__cpp' | sed -e 's,-gcc,-gcc4,')}
-%endif
+# - run unit tests
+# third_party libraries:
+# - apr - using system apr package
+# - aprutil - using system apr-util, but from this repo modified apr_memcache2.c
+# - gflags - system package may work
+# - giflib - 4.1.6, no local modifications
+# - google-sparsehash
+# - httpd, httpd24 - using system apache-devel
+# - icu - using system icu
+# - jsoncpp - no local changes
+# - libjpeg_turbo - 1.2.80 with chromium changes (but system lib should be fine)
+# - libpng - no local changes
+# - libwebp - 0.4.0, irrelevant local changes
+# - optipng - 0.7.4, local changes: only the opngreduc component of optipng is included.
+# - protobuf - should be possible to use full protobuf (not lite) to gain same functionality
+# - re2 - should be possible to use system re2
+# - serf - 0.7.2 bunch of google fixes
+# - zlib - 1.2.5, no local changes
+#
+# third_party/chromium/src/base/third_party:
+# - nspr - should be possible to use system lib
+# - dmg_fp
+# - dynamic_annotations
+# - icu - not icu lib, but two files only
+# - valgrind
+#
+# could be possible to use system libs, not packaged in pld:
+# - base64
+# - chromium
+# - chromium_deps
+# - css_parser
+# - domain_registry_provider
+# - instaweb
+# - mod_spdy
+# - modp_b64
+# - rdestl
%define mod_name pagespeed
-%define apxs %{_sbindir}/apxs
+%define apxs %{_sbindir}/apxs
Summary: Apache module for rewriting web pages to reduce latency and bandwidth
Name: apache-mod_%{mod_name}
-Version: 1.3.25.3
-Release: 0.5
+# beta: 1.9.32.x-beta
+# stable: 1.9.32.x-stable
+Version: 1.9.32.4
+Release: 8
License: Apache v2.0
Group: Networking/Daemons/HTTP
+#Source0Download: https://github.com/pagespeed/mod_pagespeed/releases
+#Source0: https://github.com/pagespeed/mod_pagespeed/archive/%{version}/mod_pagespeed-%{version}.tar.gz
Source0: modpagespeed-%{version}.tar.xz
-# Source0-md5: 7df9bf6b1aacec28d81b1678192652ca
+# Source0-md5: c6740a5de9cb7f20f0cf29c8835f6f95
Source1: get-source.sh
+Source2: gclient.conf
Patch0: system-libs.patch
-Patch1: gcc-headers.patch
+Patch1: addrinfo.patch
Patch2: bug-632.patch
-URL: https://developers.google.com/speed/pagespeed/
+Patch4: no-dev-stdout.patch
+Patch5: apache24-config.patch
+Patch6: no-force-xxbit.patch
+Patch7: no-arch-opt.patch
+Patch8: %{name}-icu.patch
+Patch9: %{name}-format.patch
+Patch10: serf-openssl1.1.patch
+Patch11: %{name}-system-protobuf.patch
+URL: https://developers.google.com/speed/pagespeed/module
BuildRequires: %{apxs}
BuildRequires: apache-devel >= 2.2
+BuildRequires: bash
BuildRequires: glib2-devel
BuildRequires: gperf
-BuildRequires: libjpeg-devel
+BuildRequires: libicu-devel
+BuildRequires: libjpeg-turbo-devel
+BuildRequires: libpng-devel
BuildRequires: libselinux-devel
BuildRequires: libstdc++-devel >= 5:4.1
BuildRequires: opencv-devel >= 2.3.1
-BuildRequires: openssl-devel
+BuildRequires: openssl-devel >= 1.1
BuildRequires: pkgconfig
+BuildRequires: protobuf-devel
BuildRequires: python-devel >= 1:2.6
+BuildRequires: yasm
# This version of gyp is new enough that it knows to use make for Linux 3.x
# and FreeBSD, but old enough that 'type': 'settings' works and
# LINKER_SUPPORTS_ICF hasn't been removed yet.
-BuildRequires: python-gyp >= 1-1175
+BuildRequires: python-gyp >= 0.1-0.svn1602.1
BuildRequires: rpmbuild(macros) >= 1.268
BuildRequires: tar >= 1:1.22
BuildRequires: util-linux
BuildRequires: xz
BuildRequires: zlib-devel
-# gcc4 might be installed, but not current __cc
-%if "%(echo %{cc_version} | cut -d. -f1,2)" < "4.0"
-BuildRequires: __cc >= 4.0
-%endif
+BuildConflicts: depot_tools < 0.1-0.20150708
Requires: apache(modules-api) = %apache_modules_api
Requires: apache-mod_authz_host
Requires: apache-mod_headers
%define htdocsdir %(%{apxs} -q htdocsdir 2>/dev/null)
%define cachedir %(%{apxs} -q proxycachedir 2>/dev/null)/mod_%{mod_name}
+# disable strip examples, http://lists.pld-linux.org/mailman/pipermail/pld-devel-en/2015-January/024223.html
+%define _noautostrip .*%{_examplesdir}/.*
+
%description
mod_pagespeed automates the application of those rules in an Apache
server. HTML, CSS, JavaScript, and images are changed dynamically
%prep
%setup -q -n modpagespeed-%{version}
-%patch0 -p2
-%patch1 -p2
-%patch2 -p2
+%patch0 -p1
+%patch1 -p0
+%patch2 -p1
+%patch4 -p1
+%patch5 -p1
+%patch6 -p1
+%patch7 -p1
+%patch8 -p1
+%patch9 -p1
+%patch10 -p1
+%patch11 -p1
+
+%if 0
+sh -x %{_sourcedir}/clean-source.sh
+%endif
+
+%{__rm} -r third_party/icu/source
+%{__rm} -r third_party/icu/genfiles
+# third_party_chromium uses "third_party/icu/..." includes
+install -d third_party/icu/source/{common,i18n}
+ln -s %{_includedir}/unicode third_party/icu/source/i18n/unicode
+ln -s %{_includedir}/unicode third_party/icu/source/common/unicode
+
+%{__rm} -r third_party/protobuf/src
%build
# re-gen makefiles
--format=make \
--depth=. \
build/all.gyp \
+ %{!?with_sse2:-Ddisable_sse2=1} \
-Duse_openssl=1 \
-Duse_system_apache_dev=1 \
+ -Duse_system_icu=1 \
-Duse_system_libjpeg=1 \
-Duse_system_libpng=1 \
-Duse_system_opencv=1 \
+ -Duse_system_openssl=1 \
+ -Duse_system_protobuf=1 \
+ -Duse_system_yasm=1 \
-Duse_system_zlib=1 \
-Dsystem_include_path_apr=%{_includedir}/apr \
-Dsystem_include_path_aprutil=%{_includedir}/apr-util \
CC.host="%{__cc}" \
CXX.host="%{__cxx}" \
LINK.host="%{__cxx}" \
- CFLAGS="%{rpmcflags} %{rpmcppflags}" \
- CXXFLAGS="%{rpmcxxflags} %{rpmcppflags}" \
+ CFLAGS="%{rpmcflags} %{rpmcppflags} -DUSE_SYSTEM_LIBJPEG" \
+ CXXFLAGS="%{rpmcxxflags} %{rpmcppflags} -DUSE_SYSTEM_LIBJPEG" \
%{nil}
%install