From 52c2cd770a8782171e3f8bd67b635ec850725a0c Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 5 Sep 2014 19:35:36 +0200 Subject: php-pecl-memcached: test build with system fastlz --- memcached-fastlz.patch | 61 +++++++++++++++++++++++++++++++++++++++++++++++++ php-pecl-memcached.spec | 28 +++++++++++++++++++---- 2 files changed, 85 insertions(+), 4 deletions(-) create mode 100644 memcached-fastlz.patch diff --git a/memcached-fastlz.patch b/memcached-fastlz.patch new file mode 100644 index 0000000..d788a52 --- /dev/null +++ b/memcached-fastlz.patch @@ -0,0 +1,61 @@ +diff -up ./config.m4.old ./config.m4 +--- ./config.m4.old 2014-04-01 12:23:39.000000000 +0200 ++++ ./config.m4 2014-09-05 19:33:38.000000000 +0200 +@@ -26,6 +26,9 @@ PHP_ARG_ENABLE(memcached-sasl, whether t + PHP_ARG_ENABLE(memcached-protocol, whether to enable memcached protocol support, + [ --enable-memcached-protocol Enable memcached protocoll support], no, no) + ++PHP_ARG_WITH(system-fastlz, wheter to use system FastLZ bibrary, ++[ --with-system-fastlz Use system FastLZ bibrary], no, no) ++ + if test -z "$PHP_ZLIB_DIR"; then + PHP_ARG_WITH(zlib-dir, for ZLIB, + [ --with-zlib-dir[=DIR] Set the path to ZLIB install prefix.], no) +@@ -336,7 +339,17 @@ if test "$PHP_MEMCACHED" != "no"; then + AC_MSG_RESULT([no]) + fi + +- PHP_MEMCACHED_FILES="php_memcached.c php_libmemcached_compat.c fastlz/fastlz.c g_fmt.c" ++ PHP_MEMCACHED_FILES="php_memcached.c php_libmemcached_compat.c g_fmt.c" ++ ++ if test "$PHP_SYSTEM_FASTLZ" != "no"; then ++ AC_CHECK_HEADERS([fastlz.h], [ac_cv_have_fastlz="yes"], [ac_cv_have_fastlz="no"]) ++ PHP_CHECK_LIBRARY(fastlz, fastlz_compress, ++ [PHP_ADD_LIBRARY(fastlz, 1, MEMCACHED_SHARED_LIBADD)], ++ [AC_MSG_ERROR(FastLZ library not found)]) ++ else ++ ac_cv_have_fastlz="no" ++ PHP_MEMCACHED_FILES="${PHP_MEMCACHED_FILES} fastlz/fastlz.c" ++ fi + + if test "$PHP_MEMCACHED_SESSION" != "no"; then + PHP_MEMCACHED_FILES="${PHP_MEMCACHED_FILES} php_memcached_session.c" +@@ -390,8 +403,10 @@ if test "$PHP_MEMCACHED" != "no"; then + PHP_SUBST(MEMCACHED_SHARED_LIBADD) + + PHP_NEW_EXTENSION(memcached, $PHP_MEMCACHED_FILES, $ext_shared,,$SESSION_INCLUDES $IGBINARY_INCLUDES $LIBEVENT_INCLUDES $MSGPACK_INCLUDES) +- PHP_ADD_BUILD_DIR($ext_builddir/fastlz, 1) +- ++ if test "ac_cv_have_fastlz" != "yes"; then ++ PHP_ADD_BUILD_DIR($ext_builddir/fastlz, 1) ++ fi ++ + ifdef([PHP_ADD_EXTENSION_DEP], + [ + PHP_ADD_EXTENSION_DEP(memcached, spl, true) +diff -up ./php_memcached.c.old ./php_memcached.c +--- ./php_memcached.c.old 2014-09-05 19:17:42.000000000 +0200 ++++ ./php_memcached.c 2014-09-05 19:17:49.000000000 +0200 +@@ -30,8 +30,11 @@ + #ifdef HAVE_MEMCACHED_SESSION + # include "php_memcached_session.h" + #endif +- ++#ifdef HAVE_FASTLZ_H ++#include ++#else + #include "fastlz/fastlz.h" ++#endif + #include + + #ifdef HAVE_JSON_API diff --git a/php-pecl-memcached.spec b/php-pecl-memcached.spec index 2ac5601..cc933c7 100644 --- a/php-pecl-memcached.spec +++ b/php-pecl-memcached.spec @@ -13,6 +13,7 @@ %{!?__pecl: %global __pecl %{_bindir}/pecl} %{!?__php: %global __php %{_bindir}/php} +%global with_fastlz 1 %global with_zts 0%{?__ztsphp:1} %global with_tests %{?_with_tests:1}%{!?_with_tests:0} %global pecl_name memcached @@ -29,7 +30,7 @@ Summary: Extension to work with the Memcached caching daemon Name: %{?scl_prefix}php-pecl-memcached Version: 2.2.0 -Release: 4%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} +Release: 5%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} # memcached is PHP, FastLZ is MIT License: PHP and MIT Group: Development/Languages @@ -37,7 +38,9 @@ URL: http://pecl.php.net/package/%{pecl_name} Source0: http://pecl.php.net/get/%{pecl_name}-%{version}%{?prever}.tgz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +Patch0: %{pecl_name}-fastlz.patch + +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) # 5.2.10 required to HAVE_JSON enabled BuildRequires: %{?scl_prefix}php-devel >= 5.2.10 BuildRequires: %{?scl_prefix}php-pear @@ -48,6 +51,9 @@ BuildRequires: %{?scl_prefix}php-pecl-msgpack-devel %endif BuildRequires: zlib-devel BuildRequires: cyrus-sasl-devel +%if %{with_fastlz} +BuildRequires: fastlz-devel +%endif %if %{with_tests} BuildRequires: memcached %endif @@ -122,13 +128,21 @@ It also provides a session handler (memcached). mv %{pecl_name}-%{version}%{?prever} NTS -# Chech version as upstream often forget to update this -extver=$(sed -n '/#define PHP_MEMCACHED_VERSION/{s/.* "//;s/".*$//;p}' NTS/php_memcached.h) +cd NTS +%patch0 -p1 -b .fastlz +%if %{with_fastlz} +rm -r fastlz +sed -e '/name="fastlz/d' -i ../package.xml +%endif + +# Check version as upstream often forget to update this +extver=$(sed -n '/#define PHP_MEMCACHED_VERSION/{s/.* "//;s/".*$//;p}' php_memcached.h) if test "x${extver}" != "x%{version}%{?intver}"; then : Error: Upstream HTTP version is now ${extver}, expecting %{version}%{?prever}. : Update the pdover macro and rebuild. exit 1 fi +cd .. cat > %{ini_name} << 'EOF' ; Enable %{pecl_name} extension module @@ -173,6 +187,9 @@ peclconf() { --disable-memcached-protocol \ %else --enable-memcached-protocol \ +%endif +%if %{with_fastlz} + --with-system-fastlz \ %endif --with-php-config=$1 } @@ -301,6 +318,9 @@ exit $ret %changelog +* Fri Aug 29 2014 Remi Collet - 2.2.0-5 +- test build with system fastlz + * Fri Aug 29 2014 Remi Collet - 2.2.0-4 - improve SCL build -- cgit