From 92d1167d820b2794323d44a98112cb0f59216510 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 7 Jul 2023 14:41:32 +0200 Subject: build out of sources tree --- php-phpiredis.spec | 87 +++++++++++++++++++++--------------------------------- 1 file changed, 34 insertions(+), 53 deletions(-) diff --git a/php-phpiredis.spec b/php-phpiredis.spec index 887e90a..4b463cb 100644 --- a/php-phpiredis.spec +++ b/php-phpiredis.spec @@ -1,16 +1,21 @@ # remirepo spec file for php-phpiredis # -# Copyright (c) 2016-2022 Remi Collet -# License: CC-BY-SA +# Copyright (c) 2016-2023 Remi Collet +# License: CC-BY-SA-4.0 # 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-phpiredis %endif +# For PHP < 5.6 and EPEL-9 +%{!?__phpize: %global __phpize %{_bindir}/phpize} +%{!?__ztsphpize: %global __ztsphpize %{_bindir}/zts-phpize} +%{!?__phpconfig: %global __phpconfig %{_bindir}/php-config} +%{!?__ztsphpconfig:%global __ztsphpconfig %{_bindir}/zts-php-config} + %bcond_without tests %global gh_commit 4b6e81fc73b9473123a353c7c71112bf66a420ae @@ -27,18 +32,20 @@ %else %global ini_name 40-%{pecl_name}.ini %endif +%global sources %{gh_project}-%{gh_commit} +%global _configure ../%{sources}/configure -Name: %{?sub_prefix}php-%{pecl_name} +Name: %{?scl_prefix}php-%{pecl_name} Version: 1.0.1 %if 0%{?gh_date} Release: 3%{gh_date}git%{gh_short}%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} %else -Release: 4%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release: 5%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} %endif Summary: Client extension for Redis -License: BSD +License: BSD-2-Clause URL: https://github.com/%{gh_owner}/%{gh_project} Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{pecl_name}-%{version}-%{gh_short}.tar.gz @@ -59,32 +66,6 @@ BuildRequires: jemalloc Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api} Requires: %{?scl_prefix}php(api) = %{php_core_api} -%{?_sclreq:Requires: %{?scl_prefix}runtime%{?_sclreq}%{?_isa}} - -%if "%{?scl_prefix}" != "%{?sub_prefix}" -Provides: %{?scl_prefix}php-%{pecl_name} = %{version}-%{release} -Provides: %{?scl_prefix}php-%{pecl_name}%{?_isa} = %{version}-%{release} -%endif - -%if "%{?packager}" == "Remi Collet" && 0%{!?scl:1} -# Other third party repo stuff -%if "%{php_version}" > "7.3" -Obsoletes: php73-%{pecl_name} <= %{version} -Obsoletes: php73-pecl-%{pecl_name} <= %{version} -%endif -%if "%{php_version}" > "7.4" -Obsoletes: php74-%{pecl_name} <= %{version} -Obsoletes: php74-pecl-%{pecl_name} <= %{version} -%endif -%if "%{php_version}" > "8.0" -Obsoletes: php80-%{pecl_name} <= %{version} -Obsoletes: php80-pecl-%{pecl_name} <= %{version} -%endif -%if "%{php_version}" > "8.1" -Obsoletes: php81-%{pecl_name} <= %{version} -Obsoletes: php81-pecl-%{pecl_name} <= %{version} -%endif -%endif %if 0%{?fedora} < 20 && 0%{?rhel} < 7 # Filter private shared @@ -103,10 +84,9 @@ Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSIO %prep %setup -q -c -mv %{gh_project}-%{gh_commit} NTS -cd NTS -%patch0 -p1 -b .pr67 +cd %{sources} +%patch -P0 -p1 -b .pr67 # Check extension version ver=$(sed -n '/define PHP_PHPIREDIS_VERSION/{s/.* "//;s/".*$//;p}' php_phpiredis.h) @@ -121,25 +101,25 @@ cat << 'EOF' | tee %{ini_name} extension=%{pecl_name}.so EOF - +mkdir NTS %if %{with_zts} -# Duplicate source tree for NTS / ZTS build -cp -pr NTS ZTS +mkdir ZTS %endif %build %{?dtsenable} -cd NTS -%{_bindir}/phpize -%configure --with-php-config=%{_bindir}/php-config +cd %{sources} +%{__phpize} + +cd ../NTS +%configure --with-php-config=%{__phpconfig} make %{?_smp_mflags} %if %{with_zts} cd ../ZTS -%{_bindir}/zts-phpize -%configure --with-php-config=%{_bindir}/zts-php-config +%configure --with-php-config=%{__ztsphpconfig} make %{?_smp_mflags} %endif @@ -172,10 +152,11 @@ install -Dpm 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name} %endif %if %{with tests} -: Upstream test suite for NTS extension +: Run test server +cd %{sources} pidfile=$PWD/redis.pid port=$(%{__php} -r 'echo 9000 + PHP_MAJOR_VERSION*100 + PHP_MINOR_VERSION*10 + PHP_INT_SIZE;') -sed -e "/REDIS_PORT/s/6379/$port/" -i ?TS/tests/testsuite_configuration.inc +sed -e "/REDIS_PORT/s/6379/$port/" -i tests/testsuite_configuration.inc mkdir -p data redis-server \ @@ -186,22 +167,19 @@ redis-server \ --dir $PWD/data \ --pidfile $pidfile -cd NTS + : Upstream test suite for NTS extension TEST_PHP_EXECUTABLE=%{__php} \ TEST_PHP_ARGS="-n -d extension=%{buildroot}%{php_extdir}/%{pecl_name}.so" \ -NO_INTERACTION=1 \ REPORT_EXIT_STATUS=1 \ -%{__php} -n run-tests.php --show-diff || ret=1 +%{__php} -n run-tests.php -q --show-diff || ret=1 %if %{with_zts} -cd ../ZTS : Upstream test suite for ZTS extension TEST_PHP_EXECUTABLE=%{__ztsphp} \ TEST_PHP_ARGS="-n -d extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so" \ -NO_INTERACTION=1 \ REPORT_EXIT_STATUS=1 \ -%{__ztsphp} -n run-tests.php --show-diff || ret=1 +%{__ztsphp} -n run-tests.php -q --show-diff || ret=1 %endif : Cleanup @@ -216,8 +194,8 @@ exit $ret %files %{!?_licensedir:%global license %%doc} -%license NTS/LICENSE -%doc NTS/README.md +%license %{sources}/LICENSE +%doc %{sources}/README.md %config(noreplace) %{php_inidir}/%{ini_name} %{php_extdir}/%{pecl_name}.so @@ -229,6 +207,9 @@ exit $ret %changelog +* Fri Jul 7 2023 Remi Collet - 1.0.1-5 +- build out of sources tree + * Tue Jan 18 2022 Remi Collet - 1.0.1-4 - add patch for hiredis 1.0.2 from https://github.com/nrk/phpiredis/pull/67 -- cgit