diff options
author | Remi Collet <fedora@famillecollet.com> | 2014-09-06 07:34:24 +0200 |
---|---|---|
committer | Remi Collet <fedora@famillecollet.com> | 2014-09-06 07:34:24 +0200 |
commit | 363072730df5132f8bb1bb2d5ece5fa8aa45ac5f (patch) | |
tree | 6a3bdd438a4ecb915850c6cbf2e1261f66889a0d | |
parent | 4b3b16dac32068e1f114cfb91c6367ef2fcd9aee (diff) |
php-pecl-yac: test build with system fastlz
-rw-r--r-- | php-pecl-yac.spec | 48 | ||||
-rw-r--r-- | yac-fastlz.patch | 59 |
2 files changed, 100 insertions, 7 deletions
diff --git a/php-pecl-yac.spec b/php-pecl-yac.spec index 471287a..736793a 100644 --- a/php-pecl-yac.spec +++ b/php-pecl-yac.spec @@ -19,20 +19,27 @@ %else %global ini_name 40-%{pecl_name}.ini %endif +%global with_fastlz 1 Summary: Lockless user data cache Name: %{?scl_prefix}php-pecl-%{pecl_name} Version: 0.9.1 -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: http://pecl.php.net/package/%{pecl_name} Source0: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz +# https://github.com/laruence/yac/pull/42 +Patch0: %{pecl_name}-fastlz.patch + BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: %{?scl_prefix}php-devel > 5.2 BuildRequires: %{?scl_prefix}php-pear +%if %{with_fastlz} +BuildRequires: fastlz-devel +%endif Requires(post): %{__pecl} Requires(postun): %{__pecl} @@ -84,6 +91,25 @@ that your product is not very sensitive to that. %setup -qc mv %{pecl_name}-%{version} NTS +# Don't install the tests +sed -e 's/role="test"/role="src"/' -i package.xml + +cd NTS +%patch0 -p1 -b .pr42 + +%if %{with_fastlz} +sed -e '\:name="compressor/fastlz:d' -i ../package.xml +rm -r compressor/fastlz +%endif + +# Check version as upstream often forget to update this +extver=$(sed -n '/#define PHP_YAC_VERSION/{s/.* "//;s/".*$//;p}' php_yac.h) +if test "x${extver}" != "x%{version}%{?prever}"; then + : Error: Upstream YAC version is ${extver}, expecting %{version}%{?prever}. + exit 1 +fi +cd .. + # Drop in the bit of configuration cat > %{ini_name} << 'EOF' ; Enable Yet Another Cache extension module @@ -105,15 +131,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 @@ -134,9 +168,6 @@ install -D -m 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name} %endif # Test & Documentation -for i in $(grep 'role="test"' package.xml | sed -e 's/^.*name="//;s/".*$//') -do install -Dpm 644 NTS/$i %{buildroot}%{pecl_testdir}/%{pecl_name}/$i -done for i in $(grep 'role="doc"' package.xml | sed -e 's/^.*name="//;s/".*$//') do install -Dpm 644 NTS/$i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i done @@ -199,7 +230,6 @@ rm -rf %{buildroot} %files %defattr(-, root, root, 0755) %doc %{pecl_docdir}/%{pecl_name} -%doc %{pecl_testdir}/%{pecl_name} %{pecl_xmldir}/%{name}.xml %config(noreplace) %{php_inidir}/%{ini_name} @@ -212,6 +242,10 @@ rm -rf %{buildroot} %changelog +* Sat Sep 6 2014 Remi Collet <remi@fedoraproject.org> - 0.9.1-3 +- test build with system fastlz +- don't install the tests + * Tue Aug 26 2014 Remi Collet <rcollet@redhat.com> - 0.9.1-2 - improve SCL build diff --git a/yac-fastlz.patch b/yac-fastlz.patch new file mode 100644 index 0000000..5a5ec3a --- /dev/null +++ b/yac-fastlz.patch @@ -0,0 +1,59 @@ +From 2ee980d2718b91aa44422221ae8cf2526bafec73 Mon Sep 17 00:00:00 2001 +From: Remi Collet <fedora@famillecollet.com> +Date: Sat, 6 Sep 2014 07:12:14 +0200 +Subject: [PATCH] add --with-system-fastlz option + +--- + config.m4 | 16 +++++++++++++++- + yac.c | 4 ++++ + 2 files changed, 19 insertions(+), 1 deletion(-) + +diff --git a/config.m4 b/config.m4 +index 73750d2..a810957 100644 +--- a/config.m4 ++++ b/config.m4 +@@ -4,6 +4,9 @@ dnl config.m4 for extension yac + PHP_ARG_ENABLE(yac, whether to enable yac support, + [ --enable-yac Enable yac support]) + ++PHP_ARG_WITH(system-fastlz, wheter to use system FastLZ bibrary, ++ [ --with-system-fastlz Use system FastLZ bibrary], no, no) ++ + dnl PHP_ARG_ENABLE(yac, whether to use msgpack as serializer, + dnl [ --enable-msgpack Use Messagepack as serializer]) + +@@ -193,6 +196,17 @@ dnl PHP_ADD_EXTENSION_DEP(yac, msgpack, true) + dnl ]) + dnl fi + ++ YAC_FILES="yac.c storage/yac_storage.c storage/allocator/yac_allocator.c storage/allocator/allocators/shm.c storage/allocator/allocators/mmap.c serializer/php.c serializer/msgpack.c" ++ if test "$PHP_SYSTEM_FASTLZ" != "no"; then ++ AC_CHECK_HEADERS([fastlz.h]) ++ PHP_CHECK_LIBRARY(fastlz, fastlz_compress, ++ [PHP_ADD_LIBRARY(fastlz, 1, YAC_SHARED_LIBADD)], ++ [AC_MSG_ERROR(FastLZ library not found)]) ++ else ++ YAC_FILES="${YAC_FILES} compressor/fastlz/fastlz.c" ++ fi ++ + if test "$PHP_YAC" != "no"; then +- PHP_NEW_EXTENSION(yac, yac.c storage/yac_storage.c storage/allocator/yac_allocator.c storage/allocator/allocators/shm.c storage/allocator/allocators/mmap.c serializer/php.c serializer/msgpack.c compressor/fastlz/fastlz.c, $ext_shared) ++ PHP_SUBST(YAC_SHARED_LIBADD) ++ PHP_NEW_EXTENSION(yac, ${YAC_FILES}, $ext_shared) + fi +diff --git a/yac.c b/yac.c +index 4362b26..20a0abb 100644 +--- a/yac.c ++++ b/yac.c +@@ -33,7 +33,11 @@ + #include "php_yac.h" + #include "storage/yac_storage.h" + #include "serializer/yac_serializer.h" ++#ifdef HAVE_FASTLZ_H ++#include <fastlz.h> ++#else + #include "compressor/fastlz/fastlz.h" ++#endif + + zend_class_entry *yac_class_ce; + |