diff options
author | Remi Collet <fedora@famillecollet.com> | 2015-03-30 19:05:13 +0200 |
---|---|---|
committer | Remi Collet <fedora@famillecollet.com> | 2015-03-30 19:05:13 +0200 |
commit | f09669fd0bbc0e83cfc194cbc726a1fe7967622e (patch) | |
tree | 0a0b3bbd4cddb56b1dcd6eed74c39d7247450b77 | |
parent | 866693c35d7151c1770674787cc9144abf0b84bc (diff) |
php-horde-horde-lz4: add fix for PHP 7
-rw-r--r-- | horde_lz4-php7.patch | 57 | ||||
-rw-r--r-- | php-horde-horde-lz4.spec | 38 |
2 files changed, 87 insertions, 8 deletions
diff --git a/horde_lz4-php7.patch b/horde_lz4-php7.patch new file mode 100644 index 0000000..2fc4d5f --- /dev/null +++ b/horde_lz4-php7.patch @@ -0,0 +1,57 @@ +From d2f0184e58d6d05569624bc52d2be76c65a9d297 Mon Sep 17 00:00:00 2001 +From: Remi Collet <fedora@famillecollet.com> +Date: Mon, 30 Mar 2015 19:00:17 +0200 +Subject: [PATCH] Fix PHP 7 compatibility + +--- + framework/lz4/horde_lz4.c | 6 +++--- + framework/lz4/horde_lz4.h | 7 +++++++ + 2 files changed, 10 insertions(+), 3 deletions(-) + +diff --git a/framework/lz4/horde_lz4.c b/framework/lz4/horde_lz4.c +index 28ec47f..23625be 100644 +--- a/framework/lz4/horde_lz4.c ++++ b/framework/lz4/horde_lz4.c +@@ -87,7 +87,7 @@ PHP_FUNCTION(horde_lz4_compress) + RETURN_FALSE; + } + +- data_len = Z_STRLEN_P(data); ++ data_len = (int)Z_STRLEN_P(data); + + output = (char *)emalloc(LZ4_compressBound(data_len) + header_offset); + if (!output) { +@@ -107,7 +107,7 @@ PHP_FUNCTION(horde_lz4_compress) + if (output_len <= 0) { + RETVAL_FALSE; + } else { +- RETVAL_STRINGL(output, output_len + header_offset, 1); ++ HORDE_LZ4_RETSTRL(output, output_len + header_offset); + } + + efree(output); +@@ -155,7 +155,7 @@ PHP_FUNCTION(horde_lz4_uncompress) + if (output_len <= 0) { + RETVAL_FALSE; + } else { +- RETVAL_STRINGL(output, data_len, 1); ++ HORDE_LZ4_RETSTRL(output, data_len); + } + + efree(output); +diff --git a/framework/lz4/horde_lz4.h b/framework/lz4/horde_lz4.h +index eb4e7a5..8ff3f7c 100644 +--- a/framework/lz4/horde_lz4.h ++++ b/framework/lz4/horde_lz4.h +@@ -23,4 +23,11 @@ PHP_MINFO_FUNCTION(horde_lz4); + PHP_FUNCTION(horde_lz4_compress); + PHP_FUNCTION(horde_lz4_uncompress); + ++#if PHP_MAJOR_VERSION < 7 ++#define HORDE_LZ4_RETSTRL(a,l) RETURN_STRINGL(a,l,1) ++#else ++typedef size_t strsize; ++#define HORDE_LZ4_RETSTRL(a,l) RETURN_STRINGL(a,l) ++#endif ++ + #endif /* PHP_HORDE_LZ4_H */ diff --git a/php-horde-horde-lz4.spec b/php-horde-horde-lz4.spec index 7f060d6..c1f7a94 100644 --- a/php-horde-horde-lz4.spec +++ b/php-horde-horde-lz4.spec @@ -29,26 +29,28 @@ Summary: Horde LZ4 Compression Extension Name: %{?scl_prefix}php-horde-horde-lz4 Version: 1.0.7 -Release: 1%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}.1 +Release: 2%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} License: MIT Group: Development/Languages URL: http://www.horde.org Source0: http://%{pecl_channel}/get/%{pecl_name}-%{version}.tgz +# https://github.com/horde/horde/pull/132 +Patch0: %{pecl_name}-php7.patch + BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: %{?scl_prefix}php-devel BuildRequires: %{?scl_prefix}php-pear -BuildRequires: %{?scl_prefix}php-channel(%{pecl_channel}) BuildRequires: lz4-devel %if %{with_tests} BuildRequires: %{_bindir}/phpunit %endif -Requires(post): %{__pecl} -Requires(postun): %{__pecl} Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api} Requires: %{?scl_prefix}php(api) = %{php_core_api} +%if ! 0%{?scl:1} Requires: %{?scl_prefix}php-channel(%{pecl_channel}) +%endif %{?_sclreq:Requires: %{?scl_prefix}runtime%{?_sclreq}%{?_isa}} Provides: %{?scl_prefix}php-%{pecl_name} = %{version} @@ -88,12 +90,20 @@ Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSIO %prep %setup -q -c + +# Don't install/register tests +# Don't install bundled libz4 +sed -e 's/role="test"/role="src"/' \ + -e '/name="lib/d' \ + -i package.xml + mv %{pecl_name}-%{version} NTS cd NTS # Use system library rm -r lib -sed -e '/name="lib/d' -i ../package.xml + +%patch0 -p3 -b .php7 # Sanity check, really often broken extver=$(sed -n '/#define HORDE_LZ4_EXT_VERSION/{s/.* "//;s/".*$//;p}' horde_lz4.h) @@ -156,12 +166,20 @@ do install -Dpm 644 NTS/$i %{buildroot}%{pear_docdir}/%{pecl_name}/$i done -%post -%{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || : +# 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 ] ; then +if [ $1 -eq 0 -a -x %{__pecl} ] ; then %{pecl_uninstall} %{pecl_channel}/%{pecl_name} >/dev/null || : fi @@ -211,6 +229,10 @@ rm -rf %{buildroot} %changelog +* Mon Mar 30 2015 Remi Collet <remi@fedoraproject.org> 1.0.7-2 +- add fix for PHP 7 +- drop runtime dependency on pear, new scriptlets + * Wed Dec 24 2014 Remi Collet <remi@fedoraproject.org> 1.0.7-1.1 - Fedora 21 SCL mass rebuild |