You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
178 lines
4.7 KiB
178 lines
4.7 KiB
%global pecl_name igbinary |
|
%global with_zts 0%{?__ztsphp:1} |
|
%global ini_name 40-%{pecl_name}.ini |
|
%global sources %{pecl_name}-%{version}%{?upstream_prever} |
|
%global _configure ../%{sources}/configure |
|
|
|
Summary: Replacement for the standard PHP serializer |
|
Name: php-pecl-igbinary |
|
Version: 3.2.16 |
|
Release: 1%{?dist} |
|
Source0: https://pecl.php.net/get/%{sources}.tgz |
|
License: BSD-3-Clause |
|
URL: https://pecl.php.net/package/igbinary |
|
BuildRequires: gcc |
|
BuildRequires: php-pear |
|
BuildRequires: php-devel >= 7.0 |
|
BuildRequires: php-pecl-apcu-devel |
|
BuildRequires: php-json |
|
# used by tests |
|
BuildRequires: tzdata |
|
Requires: php(zend-abi) = %{php_zend_api} |
|
Requires: php(api) = %{php_core_api} |
|
Provides: php-%{pecl_name} = %{version} |
|
Provides: php-%{pecl_name}%{?_isa} = %{version} |
|
Provides: php-pecl(%{pecl_name}) = %{version} |
|
Provides: php-pecl(%{pecl_name})%{?_isa} = %{version} |
|
|
|
|
|
%description |
|
Igbinary is a drop in replacement for the standard PHP serializer. |
|
|
|
Instead of time and space consuming textual representation, |
|
igbinary stores PHP data structures in a compact binary form. |
|
Savings are significant when using memcached or similar memory |
|
based storages for serialized data. |
|
|
|
|
|
%package devel |
|
Summary: Igbinary developer files (header) |
|
Requires: php-pecl-%{pecl_name}%{?_isa} = %{version}-%{release} |
|
Requires: php-devel%{?_isa} |
|
|
|
%description devel |
|
These are the files needed to compile programs using Igbinary |
|
|
|
|
|
%prep |
|
%setup -q -c |
|
|
|
sed -e '/COPYING/s/role="doc"/role="src"/' -i package.xml |
|
|
|
cd %{sources} |
|
# Check version |
|
subdir="php$(%{__php} -r 'echo (PHP_MAJOR_VERSION < 7 ? 5 : 7);')" |
|
extver=$(sed -n '/#define PHP_IGBINARY_VERSION/{s/.* "//;s/".*$//;p}' src/$subdir/igbinary.h) |
|
if test "x${extver}" != "x%{version}%{?upstream_prever}"; then |
|
: Error: Upstream version is ${extver}, expecting %{version}%{?upstream_prever}. |
|
exit 1 |
|
fi |
|
cd .. |
|
|
|
mkdir NTS |
|
%if %{with_zts} |
|
mkdir ZTS |
|
%endif |
|
|
|
cat <<EOF | tee %{ini_name} |
|
; Enable %{pecl_name} extension module |
|
extension=%{pecl_name}.so |
|
|
|
; Enable or disable compacting of duplicate strings |
|
; The default is On. |
|
;igbinary.compact_strings=On |
|
|
|
; Use igbinary as session serializer |
|
;session.serialize_handler=igbinary |
|
|
|
; Use igbinary as APC serializer |
|
;apc.serializer=igbinary |
|
EOF |
|
|
|
|
|
%build |
|
cd %{sources} |
|
%{__phpize} |
|
|
|
cd ../NTS |
|
%configure --with-php-config=%{__phpconfig} |
|
make %{?_smp_mflags} |
|
|
|
%if %{with_zts} |
|
cd ../ZTS |
|
%configure --with-php-config=%{__ztsphpconfig} |
|
make %{?_smp_mflags} |
|
%endif |
|
|
|
|
|
%install |
|
make install -C NTS INSTALL_ROOT=%{buildroot} |
|
|
|
install -D -m 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml |
|
|
|
install -D -m 644 %{ini_name} %{buildroot}%{php_inidir}/%{ini_name} |
|
|
|
# Install the ZTS stuff |
|
%if %{with_zts} |
|
make install -C ZTS INSTALL_ROOT=%{buildroot} |
|
install -D -m 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name} |
|
%endif |
|
|
|
# Test & Documentation |
|
cd %{sources} |
|
for i in $(grep 'role="test"' ../package.xml | sed -e 's/^.*name="//;s/".*$//') |
|
do [ -f $i ] && install -Dpm 644 $i %{buildroot}%{pecl_testdir}/%{pecl_name}/$i |
|
[ -f tests/$i ] && install -Dpm 644 tests/$i %{buildroot}%{pecl_testdir}/%{pecl_name}/tests/$i |
|
done |
|
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 |
|
|
|
|
|
%check |
|
cd %{sources} |
|
MOD="" |
|
# drop extension load from phpt |
|
sed -e '/^extension=/d' -i tests/*phpt |
|
|
|
: simple NTS module load test, without APC, as optional |
|
%{__php} --no-php-ini \ |
|
--define extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \ |
|
--modules | grep '^%{pecl_name}$' |
|
|
|
# APC required for test 045 |
|
if [ -f %{php_extdir}/apcu.so ]; then |
|
MOD="-d extension=apcu.so" |
|
fi |
|
# Json used in tests |
|
if [ -f %{php_extdir}/json.so ]; then |
|
MOD="$MOD -d extension=json.so" |
|
fi |
|
|
|
: upstream test suite |
|
TEST_PHP_ARGS="-n $MOD -d extension=$PWD/../NTS/modules/%{pecl_name}.so" \ |
|
%{__php} -n run-tests.php -x -q --show-diff %{?_smp_mflags} |
|
|
|
%if %{with_zts} |
|
: simple ZTS module load test, without APC, as optional |
|
%{__ztsphp} --no-php-ini \ |
|
--define extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \ |
|
--modules | grep '^%{pecl_name}$' |
|
|
|
: upstream test suite |
|
TEST_PHP_ARGS="-n $MOD -d extension=$PWD/../ZTS/modules/%{pecl_name}.so" \ |
|
%{__ztsphp} -n run-tests.php -x -q --show-diff %{?_smp_mflags} |
|
%endif |
|
|
|
|
|
%files |
|
%license %{sources}/COPYING |
|
%config(noreplace) %{php_inidir}/%{ini_name} |
|
%{php_extdir}/%{pecl_name}.so |
|
%{pecl_xmldir}/%{name}.xml |
|
|
|
%if %{with_zts} |
|
%config(noreplace) %{php_ztsinidir}/%{ini_name} |
|
%{php_ztsextdir}/%{pecl_name}.so |
|
%endif |
|
|
|
|
|
%files devel |
|
%{php_incldir}/ext/%{pecl_name} |
|
|
|
%if %{with_zts} |
|
%{php_ztsincldir}/ext/%{pecl_name} |
|
%endif |
|
|
|
|
|
%changelog
|
|
|