From ff78dc59845b144d69780841e4ea63c54b58ac2f Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 7 Jul 2023 14:49:27 +0200 Subject: build out of sources tree --- php-pecl-raphf.spec | 107 +++++++++++++++++++--------------------------------- 1 file changed, 39 insertions(+), 68 deletions(-) (limited to 'php-pecl-raphf.spec') diff --git a/php-pecl-raphf.spec b/php-pecl-raphf.spec index 6a0436e..7ec06e2 100644 --- a/php-pecl-raphf.spec +++ b/php-pecl-raphf.spec @@ -3,60 +3,46 @@ # # Fedora spec file for php-pecl-raphf # -# Copyright (c) 2013-2021 Remi Collet -# License: CC-BY-SA +# Copyright (c) 2013-2023 Remi Collet +# License: CC-BY-SA-4.0 # http://creativecommons.org/licenses/by-sa/4.0/ # # Please, preserve the changelog entries # -# we don't want -z defs linker flag -%undefine _strict_symbol_defs_build +%{?scl:%scl_package php-pecl-raphf} -%if 0%{?scl:1} -%global sub_prefix %{scl_prefix} -%scl_package php-pecl-raphf -%endif +# tests disabled because of circular dependency on pecl/http +# tests requires pecl/http 2.0.0 +%bcond_with tests -%global gh_commit b07c6f39d2ef4059d3f4cebf695e1315dc3fd5ec -%global gh_short %(c=%{gh_commit}; echo ${c:0:7}) -%global gh_owner m6w6 -%global gh_project ext-raphf -#global gh_date 20150930 %global with_zts 0%{!?_without_zts:%{?__ztsphp:1}} %global pecl_name raphf #global prever RC1 -# tests disabled because of circular dependency on pecl/http -# tests requires pecl/http 2.0.0 -%global with_tests %{?_with_tests:1}%{!?_with_tests:0} %global ini_name 40-%{pecl_name}.ini +%global sources %{pecl_name}-%{version} +%global _configure ../%{sources}/configure Summary: Resource and persistent handles factory Name: %{?scl_prefix}php-pecl-%{pecl_name} Version: 2.0.1 -%if 0%{?gh_date} -Release: 0.11.%{gh_date}git%{gh_short}%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} -Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{pecl_name}-%{version}-%{gh_short}.tar.gz -%else -Release: 6%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release: 7%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} Source0: https://pecl.php.net/get/%{pecl_name}-%{version}%{?prever}.tgz -%endif -License: BSD +License: BSD-2-Clause URL: https://pecl.php.net/package/%{pecl_name} Patch0: https://patch-diff.githubusercontent.com/raw/m6w6/ext-raphf/pull/9.patch BuildRequires: make BuildRequires: %{?dtsprefix}gcc -BuildRequires: %{?scl_prefix}php-devel > 7 +BuildRequires: %{?scl_prefix}php-devel >= 7.0 BuildRequires: %{?scl_prefix}php-pear -%if %{with_tests} +%if %{with tests} BuildRequires: %{?scl_prefix}php-pecl-http >= 2.0.0 %endif Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api} Requires: %{?scl_prefix}php(api) = %{php_core_api} -%{?_sclreq:Requires: %{?scl_prefix}runtime%{?_sclreq}%{?_isa}} Provides: %{?scl_prefix}php-%{pecl_name} = %{version} Provides: %{?scl_prefix}php-%{pecl_name}%{?_isa} = %{version} @@ -65,19 +51,6 @@ Provides: %{?scl_prefix}php-pecl-%{pecl_name}%{?_isa} = %{version}-%{rele Provides: %{?scl_prefix}php-pecl(%{pecl_name}) = %{version} Provides: %{?scl_prefix}php-pecl(%{pecl_name})%{?_isa} = %{version} -%if "%{?packager}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel} -# Other third party repo stuff -%if "%{php_version}" > "7.3" -Obsoletes: php73-pecl-%{pecl_name} <= %{version} -%endif -%if "%{php_version}" > "7.4" -Obsoletes: php74-pecl-%{pecl_name} <= %{version} -%endif -%if "%{php_version}" > "8.0" -Obsoletes: php80-pecl-%{pecl_name} <= %{version} -%endif -%endif - %description A reusable split-off of pecl_http's persistent handle and resource @@ -99,17 +72,11 @@ These are the files needed to compile programs using %{name}. %prep %setup -qc -%if 0%{?gh_date} -mv %{gh_project}-%{gh_commit} NTS -mv NTS/package.xml . -%else -mv %{pecl_name}-%{version}%{?prever} NTS -%endif %{?_licensedir:sed -e '/LICENSE/s/role="doc"/role="src"/' -i package.xml} -cd NTS -%patch0 -p1 -b .pr9 +cd %{sources} +%patch -P0 -p1 -b .pr9 # Sanity check, really often broken extver=$(sed -n '/#define PHP_RAPHF_VERSION/{s/.* "//;s/".*$//;p}' php_raphf.h) @@ -119,9 +86,9 @@ if test "x${extver}" != "x%{version}%{?prever}%{?gh_date:dev}"; then fi cd .. +mkdir NTS %if %{with_zts} -# Duplicate source tree for NTS / ZTS build -cp -pr NTS ZTS +mkdir ZTS %endif # Create configuration file @@ -137,17 +104,18 @@ EOF %build %{?dtsenable} -cd NTS -%{_bindir}/phpize +cd %{sources} +%{__phpize} + +cd ../NTS %configure \ - --with-php-config=%{_bindir}/php-config + --with-php-config=%{__phpconfig} make %{?_smp_mflags} %if %{with_zts} cd ../ZTS -%{_bindir}/zts-phpize %configure \ - --with-php-config=%{_bindir}/zts-php-config + --with-php-config=%{__ztsphpconfig} make %{?_smp_mflags} %endif @@ -173,11 +141,11 @@ install -D -m 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name} # Test & Documentation for i in $(grep 'role="test"' package.xml | sed -e 's/^.*name="//;s/".*$//') -do [ -f NTS/tests/$i ] && install -Dpm 644 NTS/tests/$i %{buildroot}%{pecl_testdir}/%{pecl_name}/tests/$i - [ -f NTS/$i ] && install -Dpm 644 NTS/$i %{buildroot}%{pecl_testdir}/%{pecl_name}/$i +do [ -f %{sources}/tests/$i ] && install -Dpm 644 %{sources}/tests/$i %{buildroot}%{pecl_testdir}/%{pecl_name}/tests/$i + [ -f %{sources}/$i ] && install -Dpm 644 %{sources}/$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 +do install -Dpm 644 %{sources}/$i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i done @@ -202,13 +170,14 @@ fi %check -cd NTS +cd %{sources} + : Minimal load test for NTS extension %{__php} --no-php-ini \ - --define extension=modules/%{pecl_name}.so \ - --modules | grep %{pecl_name} + --define extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \ + --modules | grep '^%{pecl_name}$' -%if %{with_tests} +%if %{with tests} for mod in json hash iconv propro; do if [ -f %{php_extdir}/${mod}.so ]; then modules="$modules -d extension=${mod}.so" @@ -217,23 +186,22 @@ done : Upstream test suite for NTS extension TEST_PHP_EXECUTABLE=%{__php} \ -TEST_PHP_ARGS="-n $modules -d extension=$PWD/modules/%{pecl_name}.so -d extension=http.so" \ +TEST_PHP_ARGS="-n $modules -d extension=$PWD/../NTS/modules/%{pecl_name}.so -d extension=http.so" \ NO_INTERACTION=1 \ REPORT_EXIT_STATUS=1 \ %{__php} -n run-tests.php %endif %if %{with_zts} -cd ../ZTS : Minimal load test for ZTS extension %{__ztsphp} --no-php-ini \ - --define extension=modules/%{pecl_name}.so \ - --modules | grep %{pecl_name} + --define extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \ + --modules | grep '^%{pecl_name}$' -%if %{with_tests} +%if %{with tests} : Upstream test suite for ZTS extension TEST_PHP_EXECUTABLE=%{__ztsphp} \ -TEST_PHP_ARGS="-n $modules -d extension=$PWD/modules/%{pecl_name}.so -d extension=http.so" \ +TEST_PHP_ARGS="-n $modules -d extension=$PWD/../ZTS/modules/%{pecl_name}.so -d extension=http.so" \ NO_INTERACTION=1 \ REPORT_EXIT_STATUS=1 \ %{__ztsphp} -n run-tests.php @@ -242,7 +210,7 @@ REPORT_EXIT_STATUS=1 \ %files -%{?_licensedir:%license NTS/LICENSE} +%{?_licensedir:%license %{sources}/LICENSE} %doc %{pecl_docdir}/%{pecl_name} %{pecl_xmldir}/%{name}.xml @@ -264,6 +232,9 @@ REPORT_EXIT_STATUS=1 \ %changelog +* Fri Jul 7 2023 Remi Collet - 2.0.1-7 +- build out of sources tree + * Wed Sep 01 2021 Remi Collet - 2.0.1-6 - rebuild for 8.1.0RC1 -- cgit