From 053685c037b12426a364f46e8638e0d0d9719399 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 9 Feb 2023 09:51:31 +0100 Subject: update to 1.5.3 enable ZTS build provide extension configuration file --- php-zephir-parser.spec | 89 +++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 84 insertions(+), 5 deletions(-) (limited to 'php-zephir-parser.spec') diff --git a/php-zephir-parser.spec b/php-zephir-parser.spec index ac5da3d..fe9ae0d 100644 --- a/php-zephir-parser.spec +++ b/php-zephir-parser.spec @@ -1,7 +1,7 @@ # remirepo/fedora spec file for php-zephir-parser # -# 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 @@ -19,9 +19,11 @@ %global gh_owner phalcon %global gh_project php-zephir-parser %global pecl_name zephir_parser +%global ini_name 40-%{pecl_name}.ini +%global with_zts 0%{!?_without_zts:%{?__ztsphp:1}} Name: %{?scl_prefix}%{gh_project} -Version: 1.5.2 +Version: 1.5.3 Release: 1%{?gh_date:.%{gh_date}git%{gh_short}}%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} Summary: Zephir code parser @@ -78,6 +80,17 @@ if test "x${extver}" != "x%{version}%{?gh_date:-dev}"; then fi popd +%if %{with_zts} +# Duplicate source tree for NTS / ZTS build +cp -pr NTS ZTS +%endif + +# Create configuration file +cat > %{ini_name} << 'EOF' +; Enable %{pecl_name} extension module +extension=%{pecl_name}.so +EOF + %build %{?dtsenable} @@ -91,13 +104,31 @@ pushd NTS make %{?_smp_mflags} popd +%if %{with_zts} +pushd ZTS +%{_bindir}/zts-phpize +%configure \ + --with-php-config=%{_bindir}/zts-php-config +make %{?_smp_mflags} +popd +%endif + %install %{?dtsenable} make -C NTS install INSTALL_ROOT=%{buildroot} +# install config file +install -D -m 644 %{ini_name} %{buildroot}%{php_inidir}/%{ini_name} + # Install XML package description install -D -m 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml +%if %{with_zts} +make -C ZTS install INSTALL_ROOT=%{buildroot} + +install -D -m 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name} +%endif + # Tests & 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 @@ -107,6 +138,26 @@ do install -Dpm 644 NTS/$i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i done +%if 0%{?fedora} < 24 && 0%{?rhel} < 8 +# when pear installed alone, after us +%triggerin -- %{?scl_prefix}php-pear +if [ -x %{__pecl} ] ; then + %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || : +fi + +# posttrans as pear can be installed after us +%posttrans +if [ -x %{__pecl} ] ; then + %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || : +fi + +%postun +if [ $1 -eq 0 -a -x %{__pecl} ] ; then + %{pecl_uninstall} %{pecl_name} >/dev/null || : +fi +%endif + + %check pushd NTS @@ -117,28 +168,56 @@ pushd NTS : Run test suite 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 +%{__php} -n run-tests.php -q --show-diff %else : Test suite disabled %endif popd +%if %{with_zts} +pushd ZTS +: Minimal load test for ZTS extension +%{__ztsphp} -n -d extension=modules/%{pecl_name}.so -m | grep "%{pecl_name}" + +%if %{with tests} +: Upstream test suite for ZTS extension +TEST_PHP_EXECUTABLE=%{_bindir}/zts-php \ +TEST_PHP_ARGS="-n -d extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so" \ +REPORT_EXIT_STATUS=1 \ +%{__ztsphp} -n run-tests.php -q --show-diff +%endif +popd +%endif + %files %{?_licensedir:%license NTS/LICENSE} %doc %{pecl_docdir}/%{pecl_name} %{pecl_xmldir}/%{name}.xml +%config(noreplace) %{php_inidir}/%{ini_name} %{php_extdir}/%{pecl_name}.so +%if %{with_zts} +%config(noreplace) %{php_ztsinidir}/%{ini_name} +%{php_ztsextdir}/%{pecl_name}.so +%endif %files devel %doc %{pecl_testdir}/%{pecl_name} %{php_incldir}/ext/%{pecl_name} +%if %{with_zts} +%{php_ztsincldir}/ext/%{pecl_name} +%endif + %changelog +* Thu Feb 9 2023 Remi Collet - 1.5.3-1 +- update to 1.5.3 +- enable ZTS build +- provide extension configuration file + * Thu Dec 29 2022 Remi Collet - 1.5.2-1 - update to 1.5.2 -- cgit