From c52f0a87b5c5ad2d581c201bcb9af100c8c3d49c Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 9 Feb 2017 07:47:33 +0100 Subject: php-pecl-memcached: rebuild drom pecl sources + enable tests suite --- memcached-pr3.patch | 42 ---- memcached-pr319.patch | 79 ++++++ php-pecl-memcached-dev.spec | 557 ------------------------------------------- php-pecl-memcached-php7.spec | 533 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 612 insertions(+), 599 deletions(-) delete mode 100644 memcached-pr3.patch create mode 100644 memcached-pr319.patch delete mode 100644 php-pecl-memcached-dev.spec create mode 100644 php-pecl-memcached-php7.spec diff --git a/memcached-pr3.patch b/memcached-pr3.patch deleted file mode 100644 index 5e0e194..0000000 --- a/memcached-pr3.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 5c49c02dfd0b12f46ba2909aaec31938c6e96728 Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Wed, 2 Mar 2016 11:37:50 +0100 -Subject: [PATCH] Fix build with igbinary - -Using https://github.com/igbinary/igbinary7 ---- - php_memcached.c | 10 ++++++++-- - 1 file changed, 8 insertions(+), 2 deletions(-) - -diff --git a/php_memcached.c b/php_memcached.c -index 9195bfc..09df000 100644 ---- a/php_memcached.c -+++ b/php_memcached.c -@@ -3088,11 +3088,17 @@ zend_bool s_serialize_value (enum memcached_serializer serializer, zval *value, - */ - #ifdef HAVE_MEMCACHED_IGBINARY - case SERIALIZER_IGBINARY: -- if (igbinary_serialize((uint8_t **) &buf->c, &buf->len, value) != 0) { -+ { -+ char *s; -+ size_t l; -+ if (igbinary_serialize((uint8_t **) &s, &l, value) != 0) { - php_error_docref(NULL, E_WARNING, "could not serialize value with igbinary"); - return 0; - } -+ smart_str_setl(buf, s, l); -+ efree(s); - MEMC_VAL_SET_TYPE(*flags, MEMC_VAL_IS_IGBINARY); -+ } - break; - #endif - -@@ -3306,7 +3312,7 @@ zend_bool s_unserialize_value (enum memcached_serializer serializer, int val_typ - - case MEMC_VAL_IS_IGBINARY: - #ifdef HAVE_MEMCACHED_IGBINARY -- if (igbinary_unserialize((uint8_t *)payload, payload_len, &value)) { -+ if (igbinary_unserialize((const uint8_t *)payload, payload_len, value)) { - ZVAL_FALSE(value); - php_error_docref(NULL, E_WARNING, "could not unserialize value with igbinary"); - return 0; diff --git a/memcached-pr319.patch b/memcached-pr319.patch new file mode 100644 index 0000000..6c6ec15 --- /dev/null +++ b/memcached-pr319.patch @@ -0,0 +1,79 @@ +From f8fd6228e34e1b49947890b060a501a6eab6978c Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Thu, 9 Feb 2017 07:24:15 +0100 +Subject: [PATCH] ensure tests are ok for 32bits build + +--- + tests/gh_90.phpt | 4 ++-- + tests/incrdecr.phpt | 6 +++--- + tests/incrdecr_bykey.phpt | 6 +++--- + 3 files changed, 8 insertions(+), 8 deletions(-) + +diff --git a/tests/gh_90.phpt b/tests/gh_90.phpt +index 733b761..2a16f60 100644 +--- a/tests/gh_90.phpt ++++ b/tests/gh_90.phpt +@@ -12,7 +12,7 @@ $memcached = memc_get_instance (array ( + // Create a key for use as a lock. If this key already exists, wait till it doesn't exist. + { + $key = 'LockKey'; +- $lockToken = mt_rand(0, pow(2, 32)); //Random value betwen 0 and 2^32 for ownership verification ++ $lockToken = mt_rand(0, mt_getrandmax()); //Random value for ownership verification + + while (true) + { +@@ -88,4 +88,4 @@ array(10) { + int(1) + ["9_%s"]=> + int(1) +-} +\ No newline at end of file ++} +diff --git a/tests/incrdecr.phpt b/tests/incrdecr.phpt +index cb3914a..b4e9469 100644 +--- a/tests/incrdecr.phpt ++++ b/tests/incrdecr.phpt +@@ -42,10 +42,10 @@ echo $php_errormsg, "\n"; + var_dump($m->get('foo')); + + echo "Enormous offset\n"; +-$m->increment('foo', 4294967296); ++$m->increment('foo', 0x7f000000); + var_dump($m->get('foo')); + +-$m->decrement('foo', 4294967296); ++$m->decrement('foo', 0x7f000000); + var_dump($m->get('foo')); + + --EXPECT-- +@@ -68,5 +68,5 @@ int(1) + Memcached::decrement(): offset cannot be a negative value + int(1) + Enormous offset +-int(4294967297) ++int(2130706433) + int(1) +diff --git a/tests/incrdecr_bykey.phpt b/tests/incrdecr_bykey.phpt +index 809f3b8..8b931fa 100644 +--- a/tests/incrdecr_bykey.phpt ++++ b/tests/incrdecr_bykey.phpt +@@ -39,10 +39,10 @@ echo $php_errormsg, "\n"; + var_dump($m->get('foo')); + + echo "Enormous offset\n"; +-$m->incrementByKey('foo', 'foo', 4294967296); ++$m->incrementByKey('foo', 'foo', 0x7f000000); + var_dump($m->get('foo')); + +-$m->decrementByKey('foo', 'foo', 4294967296); ++$m->decrementByKey('foo', 'foo', 0x7f000000); + var_dump($m->get('foo')); + + --EXPECT-- +@@ -62,5 +62,5 @@ int(1) + Memcached::decrementByKey(): offset cannot be a negative value + int(1) + Enormous offset +-int(4294967297) ++int(2130706433) + int(1) diff --git a/php-pecl-memcached-dev.spec b/php-pecl-memcached-dev.spec deleted file mode 100644 index 9ecf946..0000000 --- a/php-pecl-memcached-dev.spec +++ /dev/null @@ -1,557 +0,0 @@ -# remirepo spec file for php-pecl-memcached -# With SCL compatibility, from: -# -# Fedora spec file for php-pecl-memcached -# -# Copyright (c) 2009-2017 Remi Collet -# License: CC-BY-SA -# http://creativecommons.org/licenses/by-sa/4.0/ -# -# Please, preserve the changelog entries -# -%if 0%{?scl:1} -%global sub_prefix %{scl_prefix} -%scl_package php-pecl-memcached -%else -%global _root_prefix %{_prefix} -%endif - -%global with_fastlz 1 -%global with_igbin 1 -%global with_zts 0%{!?_without_zts:%{?__ztsphp:1}} -%global with_tests %{?_with_tests:1}%{!?_with_tests:0} -%global pecl_name memcached -# https://github.com/php-memcached-dev/php-memcached/commits/php7 -%global gh_commit 71f20e19253f27d6deaeab200007bd4cf9d8aec4 -%global gh_short %(c=%{gh_commit}; echo ${c:0:7}) -#global gh_date 20161207 -%global gh_owner php-memcached-dev -%global gh_project php-memcached -#global prever RC1 -#global intver rc1 -%if "%{php_version}" < "5.6" -# After igbinary, json, msgpack -%global ini_name z-%{pecl_name}.ini -%else -# After 40-igbinary, 40-json, 40-msgpack -%global ini_name 50-%{pecl_name}.ini -%endif - -Summary: Extension to work with the Memcached caching daemon -Name: %{?sub_prefix}php-pecl-memcached -Version: 3.0.1 -Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} -License: PHP -Group: Development/Languages -URL: http://pecl.php.net/package/%{pecl_name} - -Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}%{?prever}-%{gh_short}.tar.gz - -BuildRequires: %{?scl_prefix}php-devel >= 7 -BuildRequires: %{?scl_prefix}php-pear -BuildRequires: %{?scl_prefix}php-json -%if %{with_igbin} -BuildRequires: %{?sub_prefix}php-pecl-igbinary-devel -%endif -%ifnarch ppc64 -BuildRequires: %{?sub_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 - -%if 0%{?scl:1} && 0%{?fedora} < 15 && 0%{?rhel} < 7 && "%{?scl_vendor}" != "remi" -# Filter in the SCL collection -%{?filter_requires_in: %filter_requires_in %{_libdir}/.*\.so} -# libvent from SCL as not available in system -BuildRequires: %{?sub_prefix}libevent-devel > 2 -Requires: %{?sub_prefix}libevent%{_isa} > 2 -BuildRequires: %{?sub_prefix}libmemcached-devel > 1 -Requires: %{?sub_prefix}libmemcached-libs%{_isa} > 1 -%if %{with_fastlz} -Requires: fastlz%{_isa} -%endif -Requires: cyrus-sasl-lib%{_isa} -%else -BuildRequires: libevent-devel >= 2.0.2 -%if 0%{?rhel} == 5 -BuildRequires: libmemcached-devel > 1 -%else -# To ensure use of libmemcached-last for --enable-memcached-protocol -BuildRequires: libmemcached-devel >= 1.0.16 -%endif -%endif - -Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api} -Requires: %{?scl_prefix}php(api) = %{php_core_api} -Requires: %{?scl_prefix}php-json%{?_isa} -%if %{with_igbin} -Requires: %{?sub_prefix}php-pecl-igbinary%{?_isa} -%endif -%ifnarch ppc64 -Requires: %{?sub_prefix}php-pecl-msgpack%{?_isa} -%endif -%{?_sclreq:Requires: %{?scl_prefix}runtime%{?_sclreq}%{?_isa}} - -Provides: %{?scl_prefix}php-%{pecl_name} = %{version} -Provides: %{?scl_prefix}php-%{pecl_name}%{?_isa} = %{version} -Provides: %{?scl_prefix}php-pecl(%{pecl_name}) = %{version} -Provides: %{?scl_prefix}php-pecl(%{pecl_name})%{?_isa} = %{version} -%if "%{?scl_prefix}" != "%{?sub_prefix}" -Provides: %{?scl_prefix}php-pecl-%{pecl_name} = %{version}-%{release} -Provides: %{?scl_prefix}php-pecl-%{pecl_name}%{?_isa} = %{version}-%{release} -%endif - -%if "%{?vendor}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel} -# Other third party repo stuff -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} <= %{version} -Obsoletes: php55w-pecl-%{pecl_name} <= %{version} -%endif -%if "%{php_version}" > "5.6" -Obsoletes: php56u-pecl-%{pecl_name} <= %{version} -Obsoletes: php56w-pecl-%{pecl_name} <= %{version} -%endif -%if "%{php_version}" > "7.0" -Obsoletes: php70u-pecl-%{pecl_name} <= %{version} -Obsoletes: php70w-pecl-%{pecl_name} <= %{version} -%endif -%if "%{php_version}" > "7.1" -Obsoletes: php71u-pecl-%{pecl_name} <= %{version} -Obsoletes: php71w-pecl-%{pecl_name} <= %{version} -%endif -%endif - -%if 0%{?fedora} < 20 && 0%{?rhel} < 7 -# Filter private shared -%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$} -%{?filter_setup} -%endif - - -%description -This extension uses libmemcached library to provide API for communicating -with memcached servers. - -memcached is a high-performance, distributed memory object caching system, -generic in nature, but intended for use in speeding up dynamic web -applications by alleviating database load. - -It also provides a session handler (memcached). - -Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')%{?scl: as Software Collection (%{scl} by %{?scl_vendor}%{!?scl_vendor:rh})}. - - -%prep -%setup -c -q -mv %{gh_project}-%{gh_commit} NTS -%{__php} -r ' - $pkg = simplexml_load_file("NTS/package.xml"); -%if 0%{?gh_date:1} - $pkg->date = substr("%{gh_date}",0,4)."-".substr("%{gh_date}",4,2)."-".substr("%{gh_date}",6,2); - $pkg->version->release = "%{version}dev"; - $pkg->stability->release = "devel"; -%endif - $pkg->asXML("package.xml"); -' - -# Don't install/register tests -sed -e 's/role="test"/role="src"/' \ - %{?_licensedir:-e '/LICENSE/s/role="doc"/role="src"/' } \ - -i package.xml - -cd NTS -%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}%{?gh_date:-dev}%{?intver}"; then - : Error: Upstream HTTP version is now ${extver}, expecting %{version}%{?prever}%{?gh_date:-dev}. - : Update the pdover macro and rebuild. - exit 1 -fi -cd .. - -cat > %{ini_name} << 'EOF' -; Enable %{pecl_name} extension module -extension=%{pecl_name}.so - -; ----- Options to use the memcached session handler - -; RPM note : save_handler and save_path are defined -; for mod_php, in /etc/httpd/conf.d/php.conf -; for php-fpm, in %{_sysconfdir}/php-fpm.d/*conf - -; Use memcache as a session handler -;session.save_handler=memcached -; Defines a comma separated list of server urls to use for session storage -;session.save_path="localhost:11211" - -; ----- Configuration options -; http://php.net/manual/en/memcached.configuration.php - -EOF - -# default options with description from upstream -cat NTS/memcached.ini >>%{ini_name} - -%if %{with_zts} -cp -r NTS ZTS -%endif - - -%build -%{?dtsenable} - -# only needed for SCL -export PKG_CONFIG_PATH=%{_libdir}/pkgconfig - -peclconf() { -%configure \ -%if %{with_igbin} - --enable-memcached-igbinary \ -%endif - --enable-memcached-json \ - --enable-memcached-sasl \ -%ifnarch ppc64 - --enable-memcached-msgpack \ -%endif -%if 1 - --disable-memcached-protocol \ -%else - --enable-memcached-protocol \ -%endif -%if %{with_fastlz} - --with-system-fastlz \ -%endif - --with-php-config=$1 -} -cd NTS -%{_bindir}/phpize -peclconf %{_bindir}/php-config -make %{?_smp_mflags} - -%if %{with_zts} -cd ../ZTS -%{_bindir}/zts-phpize -peclconf %{_bindir}/zts-php-config -make %{?_smp_mflags} -%endif - - -%install -%{?dtsenable} - -# Install the NTS extension -make install -C NTS INSTALL_ROOT=%{buildroot} - -# Drop in the bit of configuration -# rename to z-memcached to be load after msgpack -install -D -m 644 %{ini_name} %{buildroot}%{php_inidir}/%{ini_name} - -# Install XML package description -install -D -m 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml - -# Install the ZTS extension -%if %{with_zts} -make install -C ZTS INSTALL_ROOT=%{buildroot} -install -D -m 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name} -%endif - -# Documentation -cd NTS -for i in $(grep 'role="doc"' ../package.xml | sed -e 's/^.*name="//;s/".*$//') -do install -Dpm 644 $i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i -done - - -%if 0%{?fedora} < 24 -# when pear installed alone, after us -%triggerin -- %{?scl_prefix}php-pear -if [ -x %{__pecl} ] ; then - %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || : -fi - -# posttrans as pear can be installed after us -%posttrans -if [ -x %{__pecl} ] ; then - %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || : -fi - -%postun -if [ $1 -eq 0 -a -x %{__pecl} ] ; then - %{pecl_uninstall} %{pecl_name} >/dev/null || : -fi -%endif - - -%check -OPT="-n" -[ -f %{php_extdir}/igbinary.so ] && OPT="$OPT -d extension=igbinary.so" -[ -f %{php_extdir}/json.so ] && OPT="$OPT -d extension=json.so" -[ -f %{php_extdir}/msgpack.so ] && OPT="$OPT -d extension=msgpack.so" - -: Minimal load test for NTS extension -%{__php} $OPT \ - -d extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \ - --modules | grep %{pecl_name} - -%if %{with_zts} -: Minimal load test for ZTS extension -%{__ztsphp} $OPT \ - -d extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \ - --modules | grep %{pecl_name} -%endif - -%if %{with_tests} -ret=0 - -: Launch the Memcached service -memcached -p 11211 -U 11211 -d -P $PWD/memcached.pid - -: Run the upstream test Suite for NTS extension -pushd NTS -rm tests/flush_buffers.phpt tests/touch_binary.phpt -TEST_PHP_EXECUTABLE=%{__php} \ -TEST_PHP_ARGS="$OPT -d extension=$PWD/modules/%{pecl_name}.so" \ -NO_INTERACTION=1 \ -REPORT_EXIT_STATUS=1 \ -%{__php} -n run-tests.php --show-diff tests/*phpt || ret=1 -popd - -%if %{with_zts} -: Run the upstream test Suite for ZTS extension -pushd ZTS -rm tests/flush_buffers.phpt tests/touch_binary.phpt -TEST_PHP_EXECUTABLE=%{__ztsphp} \ -TEST_PHP_ARGS="$OPT -d extension=$PWD/modules/%{pecl_name}.so" \ -NO_INTERACTION=1 \ -REPORT_EXIT_STATUS=1 \ -%{__ztsphp} -n run-tests.php --show-diff tests/*phpt || ret=1 -popd -%endif - -# Cleanup -if [ -f memcached.pid ]; then - kill $(cat memcached.pid) -fi - -exit $ret -%endif - - -%files -%{?_licensedir:%license NTS/LICENSE} -%doc %{pecl_docdir}/%{pecl_name} -%{pecl_xmldir}/%{name}.xml - -%config(noreplace) %{php_inidir}/%{ini_name} -%{php_extdir}/%{pecl_name}.so - -%if %{with_zts} -%config(noreplace) %{php_ztsinidir}/%{ini_name} -%{php_ztsextdir}/%{pecl_name}.so -%endif - - -%changelog -* Tue Feb 7 2017 Remi Collet - 3.0.1-1 -- update to 3.0.1 (php 7, stable) - -* Fri Dec 9 2016 Remi Collet - 3.0.0-0.4.20161207gite65be32 -- refresh to more recent snapshot - -* Thu Dec 1 2016 Remi Collet - 3.0.0-0.3.20160217git6ace07d -- rebuild with PHP 7.1.0 GA - -* Wed Sep 14 2016 Remi Collet - 3.0.0-0.2.20160217git6ace07d -- rebuild for PHP 7.1 new API version - -* Thu Mar 3 2016 Remi Collet - 3.0.0-0.1.20160217git6ace07d -- update to 3.0.0-dev -- switch back to php-memcached-dev sources - -* Wed Mar 2 2016 Remi Collet - 2.2.1-0.2.20150628git3c79a97 -- add patch for igbinary, see - https://github.com/rlerdorf/php-memcached/pull/3 - -* Sun Jan 10 2016 Remi Collet - 2.2.1-0.1.20150628git3c79a97 -- bump version to 2.2.1-dev, stability=devel - -* Tue Oct 13 2015 Remi Collet - 2.2.0-11.20150628git3c79a97 -- rebuild for PHP 7.0.0RC5 new API version - -* Fri Sep 18 2015 Remi Collet - 2.2.0-10.20150628git3c79a97 -- F23 rebuild with rh_layout - -* Wed Jul 22 2015 Remi Collet - 2.2.0-9.20150628git3c79a97 -- rebuild against php 7.0.0beta2 - -* Wed Jul 8 2015 Remi Collet - 2.2.0-8.20150628git3c79a97 -- new snapshot - -* Sat Jun 27 2015 Remi Collet - 2.2.0-7.20150423git4187e22 -- switch sources from pecl to github -- temporarily use rlerdorf fork (php7 compatibility) -- disable igbinary -- open https://github.com/rlerdorf/php-memcached/pull/2 - msgpack - -* Tue Jun 23 2015 Remi Collet - 2.2.0-6 -- allow build against rh-php56 (as more-php56) -- don't install/register tests -- drop runtime dependency on pear, new scriptlets - -* Wed Dec 24 2014 Remi Collet - 2.2.0-5.1 -- Fedora 21 SCL mass rebuild - -* 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 - -* Wed Apr 9 2014 Remi Collet - 2.2.0-3 -- add numerical prefix to extension configuration file - -* Wed Apr 2 2014 Remi Collet - 2.2.0-2 -- add all ini options in configuration file (comments) - -* Wed Apr 2 2014 Remi Collet - 2.2.0-1 -- update to 2.2.0 (stable) -- msgpack not available for ppc64 - -* Wed Mar 19 2014 Remi Collet - 2.2.0-0.3.RC1 -- allow SCL build - -* Thu Mar 13 2014 Remi Collet - 2.2.0-0.2.RC1 -- update to 2.2.0RC1 (beta) - -* Mon Nov 25 2013 Remi Collet - 2.2.0-0.1.b1 -- update to 2.2.0b1 (beta) -- cleanups for Copr -- install doc in pecl doc_dir -- install tests in pecl test_dir (in devel) -- add dependency on pecl/msgpack -- add --with tests option to run upstream test suite during build - -* Fri Nov 15 2013 Remi Collet - 2.1.0-7 -- drop requires libmemcached >= build version - as this can also be libmemcached-last - -* Mon Nov 19 2012 Remi Collet - 2.1.0-6 -- requires libmemcached >= build version - -* Sat Nov 17 2012 Remi Collet - 2.1.0-5 -- rebuild for libmemcached 1.0.14 (with SASL) -- switch to upstream patch -- add patch to report about SASL support in phpinfo - -* Fri Oct 19 2012 Remi Collet - 2.1.0-4 -- improve comment in configuration about session. - -* Sat Sep 22 2012 Remi Collet - 2.1.0-3 -- rebuild for new libmemcached -- drop sasl support - -* Sat Sep 8 2012 Remi Collet - 2.1.0-2 -- sync with rawhide, cleanups -- Obsoletes php53*, php54* on EL - -* Tue Aug 07 2012 Remi Collet - 2.1.0-1 -- update to 2.1.0 -- add patch to lower libmemcached required version - -* Sun Apr 22 2012 Remi Collet - 2.0.1-6 -- rebuild for libmemcached 1.0.6 (with SASL) and php 5.4 - -* Sun Apr 22 2012 Remi Collet - 2.0.1-5 -- rebuild for libmemcached 1.0.6 (with SASL) and php 5.3 - -* Sat Apr 21 2012 Remi Collet - 2.0.1-4 -- rebuild for libmemcached 1.0.6 and php 5.4 - -* Sat Apr 21 2012 Remi Collet - 2.0.1-3 -- rebuild for libmemcached 1.0.6 and php 5.3 - -* Sat Mar 03 2012 Remi Collet - 2.0.1-2 -- update to 2.0.1 for PHP 5.4 - -* Sat Mar 03 2012 Remi Collet - 2.0.1-1 -- update to 2.0.1 for PHP 5.3 - -* Sat Mar 03 2012 Remi Collet - 2.0.0-2 -- update to 2.0.0 for PHP 5.4 - -* Sat Mar 03 2012 Remi Collet - 2.0.0-1 -- update to 2.0.0 for PHP 5.3 - -* Wed Nov 16 2011 Remi Collet - 2.0.0-0.1.1736623 -- update to git snapshot (post 2.0.0b2) for php 5.4 build - -* Sun Oct 16 2011 Remi Collet - 1.0.2-10 -- rebuild against latest libmemcached (f16 only) - -* Tue Oct 04 2011 Remi Collet - 1.0.2-9 -- ZTS extension - -* Sat Sep 17 2011 Remi Collet - 1.0.2-8 -- allow relocation -- work for ZTS (not yet ok) - -* Sat Sep 17 2011 Remi Collet - 1.0.2-7 -- rebuild against libmemcached 0.52 -- adapted filter -- clean spec - -* Thu Jun 02 2011 Remi Collet - 1.0.2-6 -- rebuild against libmemcached 0.49 - -* Sat Feb 19 2011 Remi Collet - 1.0.2-3.2 -- rebuild for remi repo with SASL for fedora <= 10 and EL <= 5 - -* Sat Oct 02 2010 Remi Collet - 1.0.2-3.1 -- remove patch - -* Fri Oct 01 2010 Remi Collet - 1.0.2-3 -- rebuild against libmemcached 0.44 with SASL support - -* Wed Sep 29 2010 Remi Collet - 1.0.2-2 -- rebuild with igbinary support - -* Tue May 04 2010 Remi Collet - 1.0.2-1 -- update to 1.0.2 for libmemcached 0.40 - -* Sat Mar 13 2010 Remi Collet - 1.0.1-1 -- update to 1.0.1 for libmemcached 0.38 - -* Sun Feb 07 2010 Remi Collet - 1.0.0-3.1 -- bump release - -* Sat Feb 06 2010 Remi Collet - 1.0.0-3 -- rebuilt against new libmemcached -- add minimal %%check - -* Sun Jul 26 2009 Fedora Release Engineering - 1.0.0-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild - -* Sun Jul 12 2009 Remi Collet - 1.0.0-1 -- Update to 1.0.0 (First stable release) - -* Sat Jun 27 2009 Remi Collet - 0.2.0-1 -- Update to 0.2.0 + Patch for HAVE_JSON constant - -* Wed Apr 29 2009 Remi Collet - 0.1.5-1 -- Initial RPM - diff --git a/php-pecl-memcached-php7.spec b/php-pecl-memcached-php7.spec new file mode 100644 index 0000000..8027ef8 --- /dev/null +++ b/php-pecl-memcached-php7.spec @@ -0,0 +1,533 @@ +# remirepo spec file for php-pecl-memcached +# With SCL compatibility, from: +# +# Fedora spec file for php-pecl-memcached +# +# Copyright (c) 2009-2017 Remi Collet +# License: CC-BY-SA +# http://creativecommons.org/licenses/by-sa/4.0/ +# +# Please, preserve the changelog entries +# +%if 0%{?scl:1} +%global sub_prefix %{scl_prefix} +%scl_package php-pecl-memcached +%else +%global _root_prefix %{_prefix} +%endif + +%global with_fastlz 1 +%global with_igbin 1 +%global with_zts 0%{!?_without_zts:%{?__ztsphp:1}} +%global with_tests 0%{!?_without_tests:1} +%global pecl_name memcached +# After 40-igbinary, 40-json, 40-msgpack +%global ini_name 50-%{pecl_name}.ini + +Summary: Extension to work with the Memcached caching daemon +Name: %{?sub_prefix}php-pecl-memcached +Version: 3.0.1 +Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +License: PHP +Group: Development/Languages +URL: http://pecl.php.net/package/%{pecl_name} + +Source0: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz + +# https://github.com/php-memcached-dev/php-memcached/pull/319 +Patch0: %{pecl_name}-pr319.patch + +BuildRequires: %{?scl_prefix}php-devel >= 7 +BuildRequires: %{?scl_prefix}php-pear +BuildRequires: %{?scl_prefix}php-json +%if %{with_igbin} +BuildRequires: %{?sub_prefix}php-pecl-igbinary-devel +%endif +%ifnarch ppc64 +BuildRequires: %{?sub_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 + +BuildRequires: libevent-devel >= 2.0.2 +# To ensure use of libmemcached-last for --enable-memcached-protocol +BuildRequires: libmemcached-devel >= 1.0.16 + +Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api} +Requires: %{?scl_prefix}php(api) = %{php_core_api} +Requires: %{?scl_prefix}php-json%{?_isa} +%if %{with_igbin} +Requires: %{?sub_prefix}php-pecl-igbinary%{?_isa} +%endif +%ifnarch ppc64 +Requires: %{?sub_prefix}php-pecl-msgpack%{?_isa} +%endif +%{?_sclreq:Requires: %{?scl_prefix}runtime%{?_sclreq}%{?_isa}} + +Provides: %{?scl_prefix}php-%{pecl_name} = %{version} +Provides: %{?scl_prefix}php-%{pecl_name}%{?_isa} = %{version} +Provides: %{?scl_prefix}php-pecl(%{pecl_name}) = %{version} +Provides: %{?scl_prefix}php-pecl(%{pecl_name})%{?_isa} = %{version} +%if "%{?scl_prefix}" != "%{?sub_prefix}" +Provides: %{?scl_prefix}php-pecl-%{pecl_name} = %{version}-%{release} +Provides: %{?scl_prefix}php-pecl-%{pecl_name}%{?_isa} = %{version}-%{release} +%endif + +%if "%{?vendor}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel} +# Other third party repo stuff +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} <= %{version} +Obsoletes: php55w-pecl-%{pecl_name} <= %{version} +%endif +%if "%{php_version}" > "5.6" +Obsoletes: php56u-pecl-%{pecl_name} <= %{version} +Obsoletes: php56w-pecl-%{pecl_name} <= %{version} +%endif +%if "%{php_version}" > "7.0" +Obsoletes: php70u-pecl-%{pecl_name} <= %{version} +Obsoletes: php70w-pecl-%{pecl_name} <= %{version} +%endif +%if "%{php_version}" > "7.1" +Obsoletes: php71u-pecl-%{pecl_name} <= %{version} +Obsoletes: php71w-pecl-%{pecl_name} <= %{version} +%endif +%endif + +%if 0%{?fedora} < 20 && 0%{?rhel} < 7 +# Filter private shared +%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$} +%{?filter_setup} +%endif + + +%description +This extension uses libmemcached library to provide API for communicating +with memcached servers. + +memcached is a high-performance, distributed memory object caching system, +generic in nature, but intended for use in speeding up dynamic web +applications by alleviating database load. + +It also provides a session handler (memcached). + +Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')%{?scl: as Software Collection (%{scl} by %{?scl_vendor}%{!?scl_vendor:rh})}. + + +%prep +%setup -c -q +mv %{pecl_name}-%{version} NTS + +# Don't install/register tests +sed -e 's/role="test"/role="src"/' \ + %{?_licensedir:-e '/LICENSE/s/role="doc"/role="src"/' } \ + -i package.xml + +cd NTS +%patch0 -p1 -b .pr319 + +%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}%{?gh_date:-dev}%{?intver}"; then + : Error: Upstream HTTP version is now ${extver}, expecting %{version}%{?prever}%{?gh_date:-dev}. + : Update the pdover macro and rebuild. + exit 1 +fi +cd .. + +cat > %{ini_name} << 'EOF' +; Enable %{pecl_name} extension module +extension=%{pecl_name}.so + +; ----- Options to use the memcached session handler + +; RPM note : save_handler and save_path are defined +; for mod_php, in /etc/httpd/conf.d/php.conf +; for php-fpm, in %{_sysconfdir}/php-fpm.d/*conf + +; Use memcache as a session handler +;session.save_handler=memcached +; Defines a comma separated list of server urls to use for session storage +;session.save_path="localhost:11211" + +; ----- Configuration options +; http://php.net/manual/en/memcached.configuration.php + +EOF + +# default options with description from upstream +cat NTS/memcached.ini >>%{ini_name} + +%if %{with_zts} +cp -r NTS ZTS +%endif + + +%build +%{?dtsenable} + +# only needed for SCL +export PKG_CONFIG_PATH=%{_libdir}/pkgconfig + +peclconf() { +%configure \ +%if %{with_igbin} + --enable-memcached-igbinary \ +%endif + --enable-memcached-json \ + --enable-memcached-sasl \ +%ifnarch ppc64 + --enable-memcached-msgpack \ +%endif +%if 1 + --disable-memcached-protocol \ +%else + --enable-memcached-protocol \ +%endif +%if %{with_fastlz} + --with-system-fastlz \ +%endif + --with-php-config=$1 +} +cd NTS +%{_bindir}/phpize +peclconf %{_bindir}/php-config +make %{?_smp_mflags} + +%if %{with_zts} +cd ../ZTS +%{_bindir}/zts-phpize +peclconf %{_bindir}/zts-php-config +make %{?_smp_mflags} +%endif + + +%install +%{?dtsenable} + +# Install the NTS extension +make install -C NTS INSTALL_ROOT=%{buildroot} + +# Drop in the bit of configuration +# rename to z-memcached to be load after msgpack +install -D -m 644 %{ini_name} %{buildroot}%{php_inidir}/%{ini_name} + +# Install XML package description +install -D -m 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml + +# Install the ZTS extension +%if %{with_zts} +make install -C ZTS INSTALL_ROOT=%{buildroot} +install -D -m 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name} +%endif + +# Documentation +cd NTS +for i in $(grep 'role="doc"' ../package.xml | sed -e 's/^.*name="//;s/".*$//') +do install -Dpm 644 $i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i +done + + +%if 0%{?fedora} < 24 +# when pear installed alone, after us +%triggerin -- %{?scl_prefix}php-pear +if [ -x %{__pecl} ] ; then + %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || : +fi + +# posttrans as pear can be installed after us +%posttrans +if [ -x %{__pecl} ] ; then + %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || : +fi + +%postun +if [ $1 -eq 0 -a -x %{__pecl} ] ; then + %{pecl_uninstall} %{pecl_name} >/dev/null || : +fi +%endif + + +%check +OPT="-n" +[ -f %{php_extdir}/igbinary.so ] && OPT="$OPT -d extension=igbinary.so" +[ -f %{php_extdir}/json.so ] && OPT="$OPT -d extension=json.so" +[ -f %{php_extdir}/msgpack.so ] && OPT="$OPT -d extension=msgpack.so" + +: Minimal load test for NTS extension +%{__php} $OPT \ + -d extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \ + --modules | grep %{pecl_name} + +%if %{with_zts} +: Minimal load test for ZTS extension +%{__ztsphp} $OPT \ + -d extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \ + --modules | grep %{pecl_name} +%endif + +%if %{with_tests} +# XFAIL and very slow so no value +rm ?TS/tests/expire.phpt + +ret=0 + +: Launch the Memcached service +port=$(%{__php} -r 'echo 10000 + PHP_MAJOR_VERSION*100 + PHP_MINOR_VERSION*10 + PHP_INT_SIZE;') +memcached -p $port -U $port -d -P $PWD/memcached.pid +sed -e "s/11211/$port/" -i ?TS/tests/* + +: Run the upstream test Suite for NTS extension +pushd NTS +rm tests/flush_buffers.phpt tests/touch_binary.phpt +TEST_PHP_EXECUTABLE=%{__php} \ +TEST_PHP_ARGS="$OPT -d extension=$PWD/modules/%{pecl_name}.so" \ +NO_INTERACTION=1 \ +REPORT_EXIT_STATUS=1 \ +%{__php} -n run-tests.php --show-diff || ret=1 +popd + +%if %{with_zts} +: Run the upstream test Suite for ZTS extension +pushd ZTS +rm tests/flush_buffers.phpt tests/touch_binary.phpt +TEST_PHP_EXECUTABLE=%{__ztsphp} \ +TEST_PHP_ARGS="$OPT -d extension=$PWD/modules/%{pecl_name}.so" \ +NO_INTERACTION=1 \ +REPORT_EXIT_STATUS=1 \ +%{__ztsphp} -n run-tests.php --show-diff || ret=1 +popd +%endif + +# Cleanup +if [ -f memcached.pid ]; then + kill $(cat memcached.pid) +fi + +exit $ret +%endif + + +%files +%{?_licensedir:%license NTS/LICENSE} +%doc %{pecl_docdir}/%{pecl_name} +%{pecl_xmldir}/%{name}.xml + +%config(noreplace) %{php_inidir}/%{ini_name} +%{php_extdir}/%{pecl_name}.so + +%if %{with_zts} +%config(noreplace) %{php_ztsinidir}/%{ini_name} +%{php_ztsextdir}/%{pecl_name}.so +%endif + + +%changelog +* Thu Feb 9 2017 Remi Collet - 3.0.1-2 +- switch to pecl sources +- enable test suite +- open https://github.com/php-memcached-dev/php-memcached/pull/319 + fix test suite for 32bits build + +* Tue Feb 7 2017 Remi Collet - 3.0.1-1 +- update to 3.0.1 (php 7, stable) + +* Fri Dec 9 2016 Remi Collet - 3.0.0-0.4.20161207gite65be32 +- refresh to more recent snapshot + +* Thu Dec 1 2016 Remi Collet - 3.0.0-0.3.20160217git6ace07d +- rebuild with PHP 7.1.0 GA + +* Wed Sep 14 2016 Remi Collet - 3.0.0-0.2.20160217git6ace07d +- rebuild for PHP 7.1 new API version + +* Thu Mar 3 2016 Remi Collet - 3.0.0-0.1.20160217git6ace07d +- update to 3.0.0-dev +- switch back to php-memcached-dev sources + +* Wed Mar 2 2016 Remi Collet - 2.2.1-0.2.20150628git3c79a97 +- add patch for igbinary, see + https://github.com/rlerdorf/php-memcached/pull/3 + +* Sun Jan 10 2016 Remi Collet - 2.2.1-0.1.20150628git3c79a97 +- bump version to 2.2.1-dev, stability=devel + +* Tue Oct 13 2015 Remi Collet - 2.2.0-11.20150628git3c79a97 +- rebuild for PHP 7.0.0RC5 new API version + +* Fri Sep 18 2015 Remi Collet - 2.2.0-10.20150628git3c79a97 +- F23 rebuild with rh_layout + +* Wed Jul 22 2015 Remi Collet - 2.2.0-9.20150628git3c79a97 +- rebuild against php 7.0.0beta2 + +* Wed Jul 8 2015 Remi Collet - 2.2.0-8.20150628git3c79a97 +- new snapshot + +* Sat Jun 27 2015 Remi Collet - 2.2.0-7.20150423git4187e22 +- switch sources from pecl to github +- temporarily use rlerdorf fork (php7 compatibility) +- disable igbinary +- open https://github.com/rlerdorf/php-memcached/pull/2 - msgpack + +* Tue Jun 23 2015 Remi Collet - 2.2.0-6 +- allow build against rh-php56 (as more-php56) +- don't install/register tests +- drop runtime dependency on pear, new scriptlets + +* Wed Dec 24 2014 Remi Collet - 2.2.0-5.1 +- Fedora 21 SCL mass rebuild + +* 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 + +* Wed Apr 9 2014 Remi Collet - 2.2.0-3 +- add numerical prefix to extension configuration file + +* Wed Apr 2 2014 Remi Collet - 2.2.0-2 +- add all ini options in configuration file (comments) + +* Wed Apr 2 2014 Remi Collet - 2.2.0-1 +- update to 2.2.0 (stable) +- msgpack not available for ppc64 + +* Wed Mar 19 2014 Remi Collet - 2.2.0-0.3.RC1 +- allow SCL build + +* Thu Mar 13 2014 Remi Collet - 2.2.0-0.2.RC1 +- update to 2.2.0RC1 (beta) + +* Mon Nov 25 2013 Remi Collet - 2.2.0-0.1.b1 +- update to 2.2.0b1 (beta) +- cleanups for Copr +- install doc in pecl doc_dir +- install tests in pecl test_dir (in devel) +- add dependency on pecl/msgpack +- add --with tests option to run upstream test suite during build + +* Fri Nov 15 2013 Remi Collet - 2.1.0-7 +- drop requires libmemcached >= build version + as this can also be libmemcached-last + +* Mon Nov 19 2012 Remi Collet - 2.1.0-6 +- requires libmemcached >= build version + +* Sat Nov 17 2012 Remi Collet - 2.1.0-5 +- rebuild for libmemcached 1.0.14 (with SASL) +- switch to upstream patch +- add patch to report about SASL support in phpinfo + +* Fri Oct 19 2012 Remi Collet - 2.1.0-4 +- improve comment in configuration about session. + +* Sat Sep 22 2012 Remi Collet - 2.1.0-3 +- rebuild for new libmemcached +- drop sasl support + +* Sat Sep 8 2012 Remi Collet - 2.1.0-2 +- sync with rawhide, cleanups +- Obsoletes php53*, php54* on EL + +* Tue Aug 07 2012 Remi Collet - 2.1.0-1 +- update to 2.1.0 +- add patch to lower libmemcached required version + +* Sun Apr 22 2012 Remi Collet - 2.0.1-6 +- rebuild for libmemcached 1.0.6 (with SASL) and php 5.4 + +* Sun Apr 22 2012 Remi Collet - 2.0.1-5 +- rebuild for libmemcached 1.0.6 (with SASL) and php 5.3 + +* Sat Apr 21 2012 Remi Collet - 2.0.1-4 +- rebuild for libmemcached 1.0.6 and php 5.4 + +* Sat Apr 21 2012 Remi Collet - 2.0.1-3 +- rebuild for libmemcached 1.0.6 and php 5.3 + +* Sat Mar 03 2012 Remi Collet - 2.0.1-2 +- update to 2.0.1 for PHP 5.4 + +* Sat Mar 03 2012 Remi Collet - 2.0.1-1 +- update to 2.0.1 for PHP 5.3 + +* Sat Mar 03 2012 Remi Collet - 2.0.0-2 +- update to 2.0.0 for PHP 5.4 + +* Sat Mar 03 2012 Remi Collet - 2.0.0-1 +- update to 2.0.0 for PHP 5.3 + +* Wed Nov 16 2011 Remi Collet - 2.0.0-0.1.1736623 +- update to git snapshot (post 2.0.0b2) for php 5.4 build + +* Sun Oct 16 2011 Remi Collet - 1.0.2-10 +- rebuild against latest libmemcached (f16 only) + +* Tue Oct 04 2011 Remi Collet - 1.0.2-9 +- ZTS extension + +* Sat Sep 17 2011 Remi Collet - 1.0.2-8 +- allow relocation +- work for ZTS (not yet ok) + +* Sat Sep 17 2011 Remi Collet - 1.0.2-7 +- rebuild against libmemcached 0.52 +- adapted filter +- clean spec + +* Thu Jun 02 2011 Remi Collet - 1.0.2-6 +- rebuild against libmemcached 0.49 + +* Sat Feb 19 2011 Remi Collet - 1.0.2-3.2 +- rebuild for remi repo with SASL for fedora <= 10 and EL <= 5 + +* Sat Oct 02 2010 Remi Collet - 1.0.2-3.1 +- remove patch + +* Fri Oct 01 2010 Remi Collet - 1.0.2-3 +- rebuild against libmemcached 0.44 with SASL support + +* Wed Sep 29 2010 Remi Collet - 1.0.2-2 +- rebuild with igbinary support + +* Tue May 04 2010 Remi Collet - 1.0.2-1 +- update to 1.0.2 for libmemcached 0.40 + +* Sat Mar 13 2010 Remi Collet - 1.0.1-1 +- update to 1.0.1 for libmemcached 0.38 + +* Sun Feb 07 2010 Remi Collet - 1.0.0-3.1 +- bump release + +* Sat Feb 06 2010 Remi Collet - 1.0.0-3 +- rebuilt against new libmemcached +- add minimal %%check + +* Sun Jul 26 2009 Fedora Release Engineering - 1.0.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Sun Jul 12 2009 Remi Collet - 1.0.0-1 +- Update to 1.0.0 (First stable release) + +* Sat Jun 27 2009 Remi Collet - 0.2.0-1 +- Update to 0.2.0 + Patch for HAVE_JSON constant + +* Wed Apr 29 2009 Remi Collet - 0.1.5-1 +- Initial RPM + -- cgit