From 5e4d45fd3fcb8518b234b36963aace740e4b3cdd Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 7 Jul 2023 13:48:51 +0200 Subject: build out of sources tree --- php-pecl-json-post.spec | 72 +++++++++++++++++++++---------------------------- 1 file changed, 31 insertions(+), 41 deletions(-) diff --git a/php-pecl-json-post.spec b/php-pecl-json-post.spec index 8dde864..a2584a1 100644 --- a/php-pecl-json-post.spec +++ b/php-pecl-json-post.spec @@ -9,10 +9,13 @@ # # Please, preserve the changelog entries # -%if 0%{?scl:1} -%global sub_prefix %{scl_prefix} -%scl_package php-pecl-json-post -%endif +%{?scl:%scl_package php-pecl-json-post} + +# 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} %global with_zts 0%{!?_without_zts:%{?__ztsphp:1}} %global pecl_name json_post @@ -26,10 +29,13 @@ %endif #global prever RC2 +%global sources %{pecl_name}-%{version} +%global _configure ../%{sources}/configure + Summary: JSON POST handler -Name: %{?sub_prefix}php-pecl-json-post +Name: %{?scl_prefix}php-pecl-json-post Version: 1.1.0 -Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} License: BSD-2-Clause URL: https://pecl.php.net/package/%{pecl_name} Source0: https://pecl.php.net/get/%{pecl_name}-%{version}%{?prever}.tgz @@ -43,7 +49,6 @@ BuildRequires: %{?scl_prefix}php-pear Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api} Requires: %{?scl_prefix}php(api) = %{php_core_api} Requires: %{?scl_prefix}php-json%{?_isa} -%{?_sclreq:Requires: %{?scl_prefix}runtime%{?_sclreq}%{?_isa}} Provides: %{?scl_prefix}php-%{pecl_name} = %{version} Provides: %{?scl_prefix}php-%{pecl_name}%{?_isa} = %{version} @@ -54,22 +59,6 @@ Provides: %{?scl_prefix}php-pecl-%{pecl_name}%{?_isa} = %{version}-%{rele # Split off pecl/http Conflicts: %{?scl_prefix}php-pecl(http) < 2.4 -%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 -%if "%{php_version}" > "8.1" -Obsoletes: php81-pecl-%{pecl_name} <= %{version} -%endif -%endif - %description This extension provides a PHP content type handler for "text/json" to PHP's @@ -83,15 +72,13 @@ Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSIO %prep %setup -q -c -mv %{pecl_name}-%{version}%{?prever} NTS # Don't install/register tests sed -e 's/role="test"/role="src"/' \ %{?_licensedir:-e '/LICENSE/s/role="doc"/role="src"/' } \ -i package.xml -cd NTS - +cd %{sources} # Sanity check, really often broken extver=$(sed -n '/#define PHP_JSON_POST_VERSION/{s/.* "//;s/".*$//;p}' php_json_post.h) if test "x${extver}" != "x%{version}%{?prever}"; then @@ -100,9 +87,9 @@ if test "x${extver}" != "x%{version}%{?prever}"; 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 @@ -121,19 +108,20 @@ EOF %build %{?dtsenable} -cd NTS -%{_bindir}/phpize +cd %{sources} +%{__phpize} + +cd ../NTS %configure \ --enable-json-post \ - --with-php-config=%{_bindir}/php-config + --with-php-config=%{__phpconfig} make %{?_smp_mflags} %if %{with_zts} cd ../ZTS -%{_bindir}/zts-phpize %configure \ --enable-json-post \ - --with-php-config=%{_bindir}/zts-php-config + --with-php-config=%{__ztsphpconfig} make %{?_smp_mflags} %endif @@ -157,7 +145,7 @@ install -D -m 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name} # Documentation 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 @@ -185,20 +173,19 @@ fi OPT="-n" [ -f %{php_extdir}/json.so ] && OPT="$OPT -d extension=json.so" -cd NTS +cd %{sources} : Minimal load test for NTS extension %{__php} $OPT \ --define extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \ - --modules | grep %{pecl_name} + --modules | grep '^%{pecl_name}$' %if %{with_tests} : Upstream test suite for NTS extension TEST_PHP_EXECUTABLE=%{__php} \ TEST_PHP_CGI_EXECUTABLE=%{_bindir}/php-cgi \ -TEST_PHP_ARGS="$OPT -d extension=$PWD/modules/%{pecl_name}.so" \ -NO_INTERACTION=1 \ +TEST_PHP_ARGS="$OPT -d extension=$PWD/../NTS/modules/%{pecl_name}.so" \ REPORT_EXIT_STATUS=1 \ -%{__php} -n run-tests.php --show-diff +%{__php} -n run-tests.php -q --show-diff %endif %if %{with_zts} @@ -206,7 +193,7 @@ cd ../ZTS : Minimal load test for ZTS extension %{__ztsphp} $OPT \ --define extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \ - --modules | grep %{pecl_name} + --modules | grep '^%{pecl_name}$' %if %{with_tests} : Upstream test suite skipped as zts-php-cgi not available @@ -216,7 +203,7 @@ cd ../ZTS %files %doc %{pecl_docdir}/%{pecl_name} -%{?_licensedir:%license NTS/LICENSE} +%{?_licensedir:%license %{sources}/LICENSE} %{pecl_xmldir}/%{name}.xml %config(noreplace) %{php_inidir}/%{ini_name} @@ -229,6 +216,9 @@ cd ../ZTS %changelog +* Fri Jul 7 2023 Remi Collet - 1.1.0-2 +- build out of sources tree + * Thu Sep 23 2021 Remi Collet - 1.1.0-1 - update to 1.1.0 - add new options in provided configuration -- cgit