[php-pecl-igbinary] - latest snapshot - fix build with APCu - spec cleanups
Remi Collet
remi at fedoraproject.org
Sat Jul 27 14:54:51 UTC 2013
commit 14704488d1389fcc534ea3b77064f5fbec6da663
Author: Remi Collet <remi at fedoraproject.org>
Date: Sat Jul 27 16:54:38 2013 +0200
- latest snapshot
- fix build with APCu
- spec cleanups
.gitignore | 3 +
igbinary-apcu.patch | 222 ++++++++++++++++++++++++++++++++++++++++++++++++
igbinary-php54.patch | 12 ---
php-pecl-igbinary.spec | 155 ++++++++++++++++++++--------------
sources | 2 +-
5 files changed, 318 insertions(+), 76 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 9e5591e..50e4256 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,6 @@
+clog
+*spec~
/igbinary-1.1.1.tgz
/igbinary-tests.tgz
/igbinary-igbinary-1.1.1-15-g3b8ab7e.tar.gz
+/igbinary-1.1.2-c35d48f.tar.gz
diff --git a/igbinary-apcu.patch b/igbinary-apcu.patch
new file mode 100644
index 0000000..a5ee6d6
--- /dev/null
+++ b/igbinary-apcu.patch
@@ -0,0 +1,222 @@
+From 3dfeb1ce45bb87da31cc11613c9dd088a67300df Mon Sep 17 00:00:00 2001
+From: Remi Collet <fedora at famillecollet.com>
+Date: Thu, 4 Jul 2013 16:56:16 +0200
+Subject: [PATCH 1/2] allow to build with APC or APCU
+
+---
+ config.m4 | 13 +++++++++----
+ igbinary.c | 12 ++++++++++++
+ 2 files changed, 21 insertions(+), 4 deletions(-)
+
+diff --git a/config.m4 b/config.m4
+index d1e739f..158a222 100644
+--- a/config.m4
++++ b/config.m4
+@@ -20,10 +20,15 @@ if test "$PHP_IGBINARY" != "no"; then
+ AC_CHECK_HEADERS([stddef.h],, AC_MSG_ERROR([stddef.h not exists]))
+ AC_CHECK_HEADERS([stdint.h],, AC_MSG_ERROR([stdint.h not exists]))
+
+- AC_MSG_CHECKING([for apc includes])
+- if test -f "$phpincludedir/ext/apc/apc_serializer.h"; then
+- apc_inc_path="$phpincludedir"
+- AC_MSG_RESULT([$apc_inc_path])
++ AC_MSG_CHECKING([for APC/APCU includes])
++ if test -f "$phpincludedir/ext/apcu/apc_api.h"; then
++ apc_inc_path="$phpincludedir"
++ AC_MSG_RESULT([APCU in $apc_inc_path])
++ AC_DEFINE(HAVE_APC_SUPPORT,1,[Whether to enable apc support])
++ AC_DEFINE(HAVE_APCU_SUPPORT,1,[Whether to enable apc support via apcu])
++ elif test -f "$phpincludedir/ext/apc/apc_serializer.h"; then
++ apc_inc_path="$phpincludedir"
++ AC_MSG_RESULT([APC in $apc_inc_path])
+ AC_DEFINE(HAVE_APC_SUPPORT,1,[Whether to enable apc support])
+ elif test -f "${srcdir}/apc_serializer.h"; then
+ AC_MSG_RESULT([apc_serializer.h bundled])
+diff --git a/igbinary.c b/igbinary.c
+index 0c2eab1..157531b 100644
+--- a/igbinary.c
++++ b/igbinary.c
+@@ -28,6 +28,9 @@
+
+ #include "ext/standard/php_incomplete_class.h"
+
++#ifdef HAVE_APCU_SUPPORT
++# include "ext/apcu/apc_api.h"
++#else
+ #ifdef HAVE_APC_SUPPORT
+ # if USE_BUNDLED_APC
+ # include "apc_serializer.h"
+@@ -35,6 +38,7 @@
+ # include "ext/apc/apc_serializer.h"
+ # endif
+ #endif /* HAVE_APC_SUPPORT */
++#endif /* HAVE_APCU_SUPPORT */
+ #include "php_igbinary.h"
+
+ #include "igbinary.h"
+@@ -242,9 +246,13 @@ struct igbinary_unserialize_data {
+ #ifdef HAVE_PHP_SESSION
+ ZEND_MOD_REQUIRED("session")
+ #endif
++#ifdef HAVE_APCU_SUPPORT
++ ZEND_MOD_REQUIRED("apcu")
++#else
+ #ifdef HAVE_APC_SUPPORT
+ ZEND_MOD_OPTIONAL("apc")
+ #endif
++#endif
+ {NULL, NULL, NULL}
+ };
+ #endif
+@@ -339,11 +347,15 @@ static void php_igbinary_init_globals(zend_igbinary_globals *igbinary_globals) {
+ php_info_print_table_start();
+ php_info_print_table_row(2, "igbinary support", "enabled");
+ php_info_print_table_row(2, "igbinary version", IGBINARY_VERSION);
++#ifdef HAVE_APCU_SUPPORT
++ php_info_print_table_row(2, "igbinary APCU serializer ABI", "yes");
++#else
+ #ifdef HAVE_APC_SUPPORT
+ php_info_print_table_row(2, "igbinary APC serializer ABI", APC_SERIALIZER_ABI);
+ #else
+ php_info_print_table_row(2, "igbinary APC serializer ABI", "no");
+ #endif
++#endif
+ #if HAVE_PHP_SESSION
+ php_info_print_table_row(2, "igbinary session support", "yes");
+ #else
+--
+1.8.1.6
+
+
+From 2d95bc51e8b9f84f823d17d32a26e244afd4cda8 Mon Sep 17 00:00:00 2001
+From: Remi Collet <fedora at famillecollet.com>
+Date: Sat, 27 Jul 2013 14:45:56 +0200
+Subject: [PATCH 2/2] improve APCU build (now that APCU have restored APC
+ serializers ABI)
+
+---
+ config.m4 | 5 ++---
+ igbinary.c | 20 ++++++++++----------
+ 2 files changed, 12 insertions(+), 13 deletions(-)
+
+diff --git a/config.m4 b/config.m4
+index 158a222..4a551f2 100644
+--- a/config.m4
++++ b/config.m4
+@@ -21,11 +21,10 @@ if test "$PHP_IGBINARY" != "no"; then
+ AC_CHECK_HEADERS([stdint.h],, AC_MSG_ERROR([stdint.h not exists]))
+
+ AC_MSG_CHECKING([for APC/APCU includes])
+- if test -f "$phpincludedir/ext/apcu/apc_api.h"; then
++ if test -f "$phpincludedir/ext/apcu/apc_serializer.h"; then
+ apc_inc_path="$phpincludedir"
+ AC_MSG_RESULT([APCU in $apc_inc_path])
+- AC_DEFINE(HAVE_APC_SUPPORT,1,[Whether to enable apc support])
+- AC_DEFINE(HAVE_APCU_SUPPORT,1,[Whether to enable apc support via apcu])
++ AC_DEFINE(HAVE_APCU_SUPPORT,1,[Whether to enable apcu support])
+ elif test -f "$phpincludedir/ext/apc/apc_serializer.h"; then
+ apc_inc_path="$phpincludedir"
+ AC_MSG_RESULT([APC in $apc_inc_path])
+diff --git a/igbinary.c b/igbinary.c
+index 157531b..bc7aa6d 100644
+--- a/igbinary.c
++++ b/igbinary.c
+@@ -29,8 +29,9 @@
+ #include "ext/standard/php_incomplete_class.h"
+
+ #ifdef HAVE_APCU_SUPPORT
+-# include "ext/apcu/apc_api.h"
+-#else
++# include "ext/apcu/apc_serializer.h"
++#endif /* HAVE_APCU_SUPPORT */
++
+ #ifdef HAVE_APC_SUPPORT
+ # if USE_BUNDLED_APC
+ # include "apc_serializer.h"
+@@ -38,7 +39,7 @@
+ # include "ext/apc/apc_serializer.h"
+ # endif
+ #endif /* HAVE_APC_SUPPORT */
+-#endif /* HAVE_APCU_SUPPORT */
++
+ #include "php_igbinary.h"
+
+ #include "igbinary.h"
+@@ -60,7 +61,7 @@
+ PS_SERIALIZER_FUNCS(igbinary);
+ #endif /* HAVE_PHP_SESSION */
+
+-#ifdef HAVE_APC_SUPPORT
++#if defined(HAVE_APC_SUPPORT) || defined(HAVE_APCU_SUPPORT)
+ /** Apc serializer function prototypes */
+ static int APC_SERIALIZER_NAME(igbinary) (APC_SERIALIZER_ARGS);
+ static int APC_UNSERIALIZER_NAME(igbinary) (APC_UNSERIALIZER_ARGS);
+@@ -247,12 +248,11 @@ struct igbinary_unserialize_data {
+ ZEND_MOD_REQUIRED("session")
+ #endif
+ #ifdef HAVE_APCU_SUPPORT
+- ZEND_MOD_REQUIRED("apcu")
+-#else
++ ZEND_MOD_OPTIONAL("apcu")
++#endif
+ #ifdef HAVE_APC_SUPPORT
+ ZEND_MOD_OPTIONAL("apc")
+ #endif
+-#endif
+ {NULL, NULL, NULL}
+ };
+ #endif
+@@ -312,7 +312,7 @@ static void php_igbinary_init_globals(zend_igbinary_globals *igbinary_globals) {
+ PS_SERIALIZER_DECODE_NAME(igbinary));
+ #endif
+
+-#ifdef HAVE_APC_SUPPORT
++#if defined(HAVE_APC_SUPPORT) || defined(HAVE_APCU_SUPPORT)
+ apc_register_serializer("igbinary",
+ APC_SERIALIZER_NAME(igbinary),
+ APC_UNSERIALIZER_NAME(igbinary),
+@@ -348,7 +348,7 @@ static void php_igbinary_init_globals(zend_igbinary_globals *igbinary_globals) {
+ php_info_print_table_row(2, "igbinary support", "enabled");
+ php_info_print_table_row(2, "igbinary version", IGBINARY_VERSION);
+ #ifdef HAVE_APCU_SUPPORT
+- php_info_print_table_row(2, "igbinary APCU serializer ABI", "yes");
++ php_info_print_table_row(2, "igbinary APCU serializer ABI", APC_SERIALIZER_ABI);
+ #else
+ #ifdef HAVE_APC_SUPPORT
+ php_info_print_table_row(2, "igbinary APC serializer ABI", APC_SERIALIZER_ABI);
+@@ -604,7 +604,7 @@ IGBINARY_API int igbinary_unserialize(const uint8_t *buf, size_t buf_len, zval *
+ /* }}} */
+ #endif /* HAVE_PHP_SESSION */
+
+-#ifdef HAVE_APC_SUPPORT
++#if defined(HAVE_APC_SUPPORT) || defined(HAVE_APCU_SUPPORT)
+ /* {{{ apc_serialize function */
+ static int APC_SERIALIZER_NAME(igbinary) ( APC_SERIALIZER_ARGS ) {
+ (void)config;
+--
+1.8.1.6
+
+From 272e78821b96815fc40d364f9971add10a0bf66e Mon Sep 17 00:00:00 2001
+From: Remi Collet <fedora at famillecollet.com>
+Date: Sat, 27 Jul 2013 15:03:06 +0200
+Subject: [PATCH] fix test when APCU used
+
+---
+ tests/igbinary_029.phpt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tests/igbinary_029.phpt b/tests/igbinary_029.phpt
+index 9027638..f1941d2 100644
+--- a/tests/igbinary_029.phpt
++++ b/tests/igbinary_029.phpt
+@@ -19,6 +19,6 @@ echo implode("\n", $array);
+ igbinary
+ igbinary support => enabled
+ igbinary version => %s
+-igbinary APC serializer ABI => %s
++igbinary AP%s serializer ABI => %s
+ igbinary session support => %s
+ igbinary.compact_strings => %s => %s
+--
+1.8.3.1
+
diff --git a/php-pecl-igbinary.spec b/php-pecl-igbinary.spec
index 40f45f0..5e012e7 100644
--- a/php-pecl-igbinary.spec
+++ b/php-pecl-igbinary.spec
@@ -1,27 +1,31 @@
-%{!?__pecl: %{expand: %%global __pecl %{_bindir}/pecl}}
-%{!?php_extdir: %{expand: %%global php_extdir %(php-config --extension-dir)}}
+# spec file for php-pecl-igbinary
+#
+# Copyright (c) 2010-2013 Remi Collet
+# License: CC-BY-SA
+# http://creativecommons.org/licenses/by-sa/3.0/
+#
+# Please, preserve the changelog entries
+#
+%{!?php_inidir: %{expand: %%global php_inidir %{_sysconfdir}/php.d}}
+%{!?php_incldir: %{expand: %%global php_incldir %{_includedir}/php}}
+%{!?__pecl: %{expand: %%global __pecl %{_bindir}/pecl}}
%global extname igbinary
-%global gitver 3b8ab7e
+%global with_zts 0%{?__ztsphp:1}
+%global commit c35d48f3d14794373b2ef89a6d79020bb7418d7f
+%global short %(c=%{commit}; echo ${c:0:7})
%global prever -dev
-%if 0%{?fedora} >= 14
-%global withapc 1
-%else
-# EL-6 only provides 3.1.3pl1
-%global withapc 0
-%endif
-
Summary: Replacement for the standard PHP serializer
Name: php-pecl-igbinary
Version: 1.1.2
-%if 0%{?gitver:1}
-Release: 0.5.git%{gitver}%{?dist}
-Source0: igbinary-igbinary-1.1.1-15-g3b8ab7e.tar.gz
+%if 0%{?short:1}
+Release: 0.6.git%{short}%{?dist}
+Source0: https://github.com/%{extname}/%{extname}/archive/%{commit}/%{extname}-%{version}-%{short}.tar.gz
%else
-Release: 3%{?dist}
+Release: 2%{?dist}
Source0: http://pecl.php.net/get/%{extname}-%{version}.tgz
-# https://bugs.php.net/59668
+# http://pecl.php.net/bugs/22598
Source1: %{extname}-tests.tgz
%endif
# https://bugs.php.net/59669
@@ -30,28 +34,27 @@ Group: System Environment/Libraries
URL: http://pecl.php.net/package/igbinary
-# https://bugs.php.net/60298
-Patch0: igbinary-php54.patch
+# https://github.com/igbinary/igbinary/pull/24
+Patch0: igbinary-apcu.patch
-BuildRoot: %{_tmppath}/%{name}-%{version}-root-%(%{__id_u} -n)
+BuildRequires: php-pear
BuildRequires: php-devel >= 5.2.0
-%if %{withapc}
+# php-pecl-apcu-devel provides php-pecl-apc-devel
BuildRequires: php-pecl-apc-devel >= 3.1.7
-%else
-BuildRequires: php-pear
-%endif
Requires(post): %{__pecl}
Requires(postun): %{__pecl}
Requires: php(zend-abi) = %{php_zend_api}
Requires: php(api) = %{php_core_api}
+
+Provides: php-%{extname} = %{version}
+Provides: php-%{extname}%{?_isa} = %{version}
Provides: php-pecl(%{extname}) = %{version}
+Provides: php-pecl(%{extname})%{?_isa} = %{version}
-# RPM 4.8
+# Filter private shared
%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$}
%{?filter_setup}
-# RPM 4.9
-%global __provides_exclude_from %{?__provides_exclude_from:%__provides_exclude_from|}%{_libdir}/.*\\.so$
%description
@@ -67,7 +70,7 @@ based storages for serialized data.
Summary: Igbinary developer files (header)
Group: Development/Libraries
Requires: php-pecl-%{extname}%{?_isa} = %{version}-%{release}
-Requires: php-devel
+Requires: php-devel%{?_isa}
%description devel
These are the files needed to compile programs using Igbinary
@@ -76,16 +79,18 @@ These are the files needed to compile programs using Igbinary
%prep
%setup -q -c
-%if 0%{?gitver:1}
-mv igbinary-igbinary-%{gitver}/package.xml .
-mv igbinary-igbinary-%{gitver} %{extname}-%{version}
+%if 0%{?short:1}
+mv igbinary-%{commit}/package.xml .
+mv igbinary-%{commit} %{extname}-%{version}
+sed -e '/release/s/-dev/dev/' -i package.xml
+
cd %{extname}-%{version}
-%patch0 -p0 -b .php54
+
+%patch0 -p1 -b .apcu
%else
cd %{extname}-%{version}
tar xzf %{SOURCE1}
-
%endif
# Check version
@@ -96,6 +101,10 @@ if test "x${extver}" != "x%{version}%{?prever}"; then
fi
cd ..
+%if %{with_zts}
+cp -r %{extname}-%{version} %{extname}-%{version}-zts
+%endif
+
cat <<EOF | tee %{extname}.ini
; Enable %{extname} extension module
extension=%{extname}.so
@@ -107,14 +116,10 @@ extension=%{extname}.so
; Use igbinary as session serializer
;session.serialize_handler=igbinary
-%if %{withapc}
; Use igbinary as APC serializer
;apc.serializer=igbinary
-%endif
EOF
-cp -r %{extname}-%{version} %{extname}-%{version}-zts
-
%build
cd %{extname}-%{version}
@@ -122,7 +127,7 @@ cd %{extname}-%{version}
%configure --with-php-config=%{_bindir}/php-config
make %{?_smp_mflags}
-%if 0%{?__ztsphp:1}
+%if %{with_zts}
cd ../%{extname}-%{version}-zts
%{_bindir}/zts-phpize
%configure --with-php-config=%{_bindir}/zts-php-config
@@ -131,17 +136,18 @@ make %{?_smp_mflags}
%install
-rm -rf %{buildroot}
+# for short circuit
+rm -f %{extname}*/modules/apc.so
make install -C %{extname}-%{version} \
INSTALL_ROOT=%{buildroot}
install -D -m 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml
-install -D -m 644 %{extname}.ini %{buildroot}%{_sysconfdir}/php.d/%{extname}.ini
+install -D -m 644 %{extname}.ini %{buildroot}%{php_inidir}/%{extname}.ini
# Install the ZTS stuff
-%if 0%{?__ztsphp:1}
+%if %{with_zts}
make install -C %{extname}-%{version}-zts \
INSTALL_ROOT=%{buildroot}
install -D -m 644 %{extname}.ini %{buildroot}%{php_ztsinidir}/%{extname}.ini
@@ -149,32 +155,49 @@ install -D -m 644 %{extname}.ini %{buildroot}%{php_ztsinidir}/%{extname}.ini
%check
-# simple module load test
-# without APC to ensure than can run without
+cd %{extname}-%{version}
+
+# APC required for test 045
+if [ -f %{php_extdir}/apcu.so ]; then
+ ln -s %{php_extdir}/apcu.so modules/apc.so
+elif [ -f %{php_extdir}/apc.so ]; then
+ ln -s %{php_extdir}/apc.so modules/apc.so
+fi
+
+: simple NTS module load test, without APC, as optional
%{_bindir}/php --no-php-ini \
- --define extension_dir=%{extname}-%{version}/modules \
+ --define extension_dir=modules \
--define extension=%{extname}.so \
--modules | grep %{extname}
-%{_bindir}/zts-php --no-php-ini \
- --define extension_dir=%{extname}-%{version}-zts/modules \
+: upstream test suite
+TEST_PHP_EXECUTABLE=%{_bindir}/php \
+TEST_PHP_ARGS="-n -d extension_dir=$PWD/modules -d extension=apc.so -d extension=%{extname}.so" \
+NO_INTERACTION=1 \
+REPORT_EXIT_STATUS=1 \
+%{_bindir}/php -n run-tests.php
+
+%if %{with_zts}
+cd ../%{extname}-%{version}-zts
+if [ -f %{php_ztsextdir}/apcu.so ]; then
+ ln -s %{php_ztsextdir}/apcu.so modules/apc.so
+elif [ -f %{php_ztsextdir}/apc.so ]; then
+ ln -s %{php_ztsextdir}/apc.so modules/apc.so
+fi
+: simple ZTS module load test, without APC, as optional
+%{__ztsphp} --no-php-ini \
+ --define extension_dir=modules \
--define extension=%{extname}.so \
--modules | grep %{extname}
-cd %{extname}-%{version}
-%if %{withapc}
-# APC required for test 045
-ln -s %{php_extdir}/apc.so modules/
+: upstream test suite
+TEST_PHP_EXECUTABLE=%{__ztsphp} \
+TEST_PHP_ARGS="-n -d extension_dir=$PWD/modules -d extension=apc.so -d extension=%{extname}.so" \
+NO_INTERACTION=1 \
+REPORT_EXIT_STATUS=1 \
+%{__ztsphp} -n run-tests.php
%endif
-NO_INTERACTION=1 make test | tee rpmtests.log
-# https://bugs.php.net/60298
-# grep -q "FAILED TEST" rpmtests.log && exit 1
-
-
-%clean
-rm -rf %{buildroot}
-
%post
%{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || :
@@ -187,29 +210,35 @@ fi
%files
-%defattr(-,root,root,-)
%doc %{extname}-%{version}/COPYING
%doc %{extname}-%{version}/CREDITS
+%doc %{extname}-%{version}/ChangeLog
%doc %{extname}-%{version}/NEWS
%doc %{extname}-%{version}/README
-%config(noreplace) %{_sysconfdir}/php.d/%{extname}.ini
+%config(noreplace) %{php_inidir}/%{extname}.ini
%{php_extdir}/%{extname}.so
%{pecl_xmldir}/%{name}.xml
-%if 0%{?__ztsphp:1}
-%{php_ztsextdir}/%{extname}.so
+
+%if %{with_zts}
%config(noreplace) %{php_ztsinidir}/%{extname}.ini
+%{php_ztsextdir}/%{extname}.so
%endif
%files devel
-%defattr(-,root,root,-)
-%{_includedir}/php/ext/%{extname}
-%if 0%{?__ztsphp:1}
+%{php_incldir}/ext/%{extname}
+
+%if %{with_zts}
%{php_ztsincldir}/ext/%{extname}
%endif
%changelog
+* Sat Jul 27 2013 Remi Collet <remi at fedoraproject.org> - 1.1.2-0.6.git3b8ab7e
+- latest snapshot
+- fix build with APCu
+- spec cleanups
+
* Fri Mar 22 2013 Remi Collet <rcollet at redhat.com> - 1.1.2-0.5.git3b8ab7e
- rebuild for http://fedoraproject.org/wiki/Features/Php55
diff --git a/sources b/sources
index 0a69ada..4036684 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-64a3074e2d826ede4e28a0f81a51b871 igbinary-igbinary-1.1.1-15-g3b8ab7e.tar.gz
+9d643ddd846edcbf1e34298e58feedaf igbinary-1.1.2-c35d48f.tar.gz
More information about the scm-commits
mailing list