diff options
author | Remi Collet <fedora@famillecollet.com> | 2014-09-06 08:51:57 +0200 |
---|---|---|
committer | Remi Collet <fedora@famillecollet.com> | 2014-09-06 08:51:57 +0200 |
commit | 22047b28a3aa55521ef355b9ea954021870ae591 (patch) | |
tree | 853bd3f9d84ae8839514141c1ac201092356fba5 | |
parent | 4b11021fa0eed0798c70e1722bb3146cd7ec39f1 (diff) |
php-pecl-couchbase: use system fastlz
-rw-r--r-- | couchbase-fastlz.patch | 84 | ||||
-rw-r--r-- | php-pecl-couchbase.spec | 46 |
2 files changed, 119 insertions, 11 deletions
diff --git a/couchbase-fastlz.patch b/couchbase-fastlz.patch new file mode 100644 index 0000000..e40f2e2 --- /dev/null +++ b/couchbase-fastlz.patch @@ -0,0 +1,84 @@ +From 8e3c76129ff52964d6043076ed2e1c443ceb262c Mon Sep 17 00:00:00 2001 +From: Remi Collet <fedora@famillecollet.com> +Date: Sat, 6 Sep 2014 08:45:03 +0200 +Subject: [PATCH] add --with-system-fastlz option + +--- + config.m4 | 27 +++++++++++++++++++++------ + internal.h | 4 ++++ + 2 files changed, 25 insertions(+), 6 deletions(-) + +diff --git a/config.m4 b/config.m4 +index fc730d6..b3661f5 100644 +--- a/config.m4 ++++ b/config.m4 +@@ -1,6 +1,9 @@ + PHP_ARG_WITH([couchbase], [for Couchbase support], + [ --with-couchbase Include Couchbase support]) + ++PHP_ARG_WITH(system-fastlz, wheter to use system FastLZ bibrary, ++ [ --with-system-fastlz Use system FastLZ bibrary], no, no) ++ + if test "$PHP_COUCHBASE" != "no"; then + dnl PCBC-180 Add support for igbinary. + dnl The PHP include directories is not searched by default, so +@@ -25,9 +28,7 @@ if test "$PHP_COUCHBASE" != "no"; then + PHP_ADD_EXTENSION_DEP(couchbase, igbinary) + ]) + +- PHP_SUBST(COUCHBASE_SHARED_LIBADD) +- PHP_NEW_EXTENSION([couchbase], +- [ \ ++ COUCHBASE_FILES="\ + apidecl.c \ + arithmetic.c \ + ccache.c \ +@@ -38,7 +39,6 @@ if test "$PHP_COUCHBASE" != "no"; then + designdoc.c \ + error.c \ + exceptions.c \ +- fastlz/fastlz.c \ + flush.c \ + get.c \ + ht.c \ +@@ -60,7 +60,22 @@ if test "$PHP_COUCHBASE" != "no"; then + version.c \ + viewopts.c \ + views.c \ +- ], [$ext_shared]) ++ " ++ if test "$PHP_SYSTEM_FASTLZ" != "no"; then ++ AC_CHECK_HEADERS([fastlz.h], [have_fastlz="yes"], [have_fastlz="no"]) ++ PHP_CHECK_LIBRARY(fastlz, fastlz_compress, ++ [PHP_ADD_LIBRARY(fastlz, 1, COUCHBASE_SHARED_LIBADD)], ++ [AC_MSG_ERROR(FastLZ library not found)]) ++ else ++ have_fastlz="no" ++ COUCHBASE_FILES="${COUCHBASE_FILES} fastlz/fastlz.c" ++ fi ++ PHP_SUBST(COUCHBASE_SHARED_LIBADD) ++ ++ PHP_NEW_EXTENSION([couchbase], ++ [ $COUCHBASE_FILES ], [$ext_shared]) ++ if test "have_fastlz" != "yes"; then + PHP_ADD_BUILD_DIR($ext_builddir/fastlz, 1) +- PHP_ADD_BUILD_DIR($ext_builddir/management, 1) ++ fi ++ PHP_ADD_BUILD_DIR($ext_builddir/management, 1) + fi +diff --git a/internal.h b/internal.h +index 8939d9c..56cab92 100644 +--- a/internal.h ++++ b/internal.h +@@ -56,7 +56,11 @@ + #include "ext/standard/php_var.h" + #include <libcouchbase/couchbase.h> + #include "php_couchbase.h" ++#ifdef HAVE_FASTLZ_H ++#include <fastlz.h> ++#else + #include "fastlz/fastlz.h" ++#endif + + #ifdef PHP_WIN32 + #ifndef PRIu64 diff --git a/php-pecl-couchbase.spec b/php-pecl-couchbase.spec index 6df4e8e..ad9945f 100644 --- a/php-pecl-couchbase.spec +++ b/php-pecl-couchbase.spec @@ -14,6 +14,7 @@ %global pecl_name couchbase %global with_zts 0%{?__ztsphp:1} +%global with_fastlz 1 %if "%{php_version}" < "5.6" # After igbinary @@ -26,12 +27,15 @@ Summary: Couchbase Server PHP extension Name: %{?scl_prefix}php-pecl-couchbase Version: 1.2.2 -Release: 2%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} +Release: 3%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} License: PHP Group: Development/Languages URL: pecl.php.net/package/couchbase Source0: http://pecl.php.net/get/%{pecl_name}-%{version}%{?svnrev:-dev}.tgz +# https://github.com/couchbase/php-ext-couchbase/pull/11 +Patch0: %{pecl_name}-fastlz.patch + BuildRequires: %{?scl_prefix}php-devel >= 5.3.0 BuildRequires: %{?scl_prefix}php-pecl-igbinary-devel BuildRequires: %{?scl_prefix}php-pear @@ -39,6 +43,9 @@ BuildRequires: zlib-devel BuildRequires: libcouchbase-devel # for tests BuildRequires: %{?scl_prefix}php-json +%if %{with_fastlz} +BuildRequires: fastlz-devel +%endif Requires(post): %{__pecl} Requires(postun): %{__pecl} @@ -53,17 +60,17 @@ Provides: %{?scl_prefix}php-pecl(%{pecl_name})%{?_isa} = %{version} %if "%{?vendor}" == "Remi Collet" && 0%{!?scl:1} # Other third party repo stuff -Obsoletes: php53-pecl-%{pecl_name} -Obsoletes: php53u-pecl-%{pecl_name} -Obsoletes: php54-pecl-%{pecl_name} -Obsoletes: php54w-pecl-%{pecl_name} +Obsoletes: php53-pecl-%{pecl_name} <= %{version} +Obsoletes: php53u-pecl-%{pecl_name} <= %{version} +Obsoletes: php54-pecl-%{pecl_name} <= %{version} +Obsoletes: php54w-pecl-%{pecl_name} <= %{version} %if "%{php_version}" > "5.5" -Obsoletes: php55u-pecl-%{pecl_name} -Obsoletes: php55w-pecl-%{pecl_name} +Obsoletes: php55u-pecl-%{pecl_name} <= %{version} +Obsoletes: php55w-pecl-%{pecl_name} <= %{version} %endif %if "%{php_version}" > "5.6" -Obsoletes: php56u-pecl-%{pecl_name} -Obsoletes: php56w-pecl-%{pecl_name} +Obsoletes: php56u-pecl-%{pecl_name} <= %{version} +Obsoletes: php56w-pecl-%{pecl_name} <= %{version} %endif %endif @@ -85,6 +92,12 @@ in a Couchbase Server. mv %{pecl_name}-%{version} NTS cd NTS +%patch0 -p1 -b .fastlz +%if %{with_fastlz} +rm -r fastlz +sed -e '/name="fastlz/d' -i ../package.xml +%endif + # Fix version sed -e '/PHP_COUCHBASE_VERSION/s/1.2.0/%{version}/' -i php_couchbase.h @@ -105,15 +118,23 @@ cp -pr NTS ZTS %build +peclconf() { +%configure \ +%if %{with_fastlz} + --with-system-fastlz \ +%endif + --with-php-config=$1 +} + cd NTS %{_bindir}/phpize -%configure --with-php-config=%{_bindir}/php-config +peclconf %{_bindir}/php-config make %{?_smp_mflags} %if %{with_zts} cd ../ZTS %{_bindir}/zts-phpize -%configure --with-php-config=%{_bindir}/zts-php-config +peclconf %{_bindir}/zts-php-config make %{?_smp_mflags} %endif @@ -183,6 +204,9 @@ fi %changelog +* Sat Sep 6 2014 Remi Collet <remi@fedoraproject.org> - 1.2.2-3 +- test build with system fastlz + * Tue Aug 26 2014 Remi Collet <rcollet@redhat.com> - 1.2.2-2 - improve SCL build |