diff options
| -rw-r--r-- | php-ast.spec | 52 | 
1 files changed, 35 insertions, 17 deletions
diff --git a/php-ast.spec b/php-ast.spec index 8ac9371..6314b2f 100644 --- a/php-ast.spec +++ b/php-ast.spec @@ -8,18 +8,26 @@  #  %{?scl:          %scl_package         php-ast} +# Defined in Fedora >= 37 and RHEL >= 10, in PHP >= 7.4 for remirepo +%{!?__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 pecl_name   ast  %global with_zts    0%{!?_without_zts:%{?__ztsphp:1}}  # After 20-tokenizer.ini  %global ini_name    40-%{pecl_name}.ini +%global sources     %{pecl_name}-%{version} +%global _configure  ../%{sources}/configure  Summary:       Abstract Syntax Tree  Name:          %{?scl_prefix}php-ast  Version:       1.1.0 -Release:       3%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release:       4%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}  License:       BSD-3-Clause  URL:           https://pecl.php.net/package/ast -Source0:       http://pecl.php.net/get/%{pecl_name}-%{version}.tgz +Source0:       http://pecl.php.net/get/%{sources}.tgz  BuildRequires: make  BuildRequires: %{?dtsprefix}gcc @@ -53,7 +61,7 @@ sed -e 's/role="test"/role="src"/' \      %{?_licensedir:-e '/LICENSE/s/role="doc"/role="src"/' } \      -i package.xml -cd %{pecl_name}-%{version} +cd %{sources}  # Sanity check, really often broken  extver=$(sed -n '/#define PHP_AST_VERSION/{s/.* "//;s/".*$//;p}' php_ast.h)  if test "x${extver}" != "x%{version}"; then @@ -73,24 +81,23 @@ cat << 'EOF' | tee %{ini_name}  extension = %{pecl_name}.so  EOF -%global _configure ../%{pecl_name}-%{version}/configure  %build  %{?dtsenable} -cd %{pecl_name}-%{version} -%{_bindir}/phpize +cd %{sources} +%{__phpize}  cd ../NTS  %configure \ -    --with-php-config=%{_bindir}/php-config \ +    --with-php-config=%{__phpconfig} \      --enable-ast  make %{?_smp_mflags}  %if %{with_zts}  cd ../ZTS  %configure \ -    --with-php-config=%{_bindir}/zts-php-config \ +    --with-php-config=%{__ztsphpconfig} \      --enable-ast  make %{?_smp_mflags}  %endif @@ -114,23 +121,33 @@ 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 %{pecl_name}-%{version}/$i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i +do install -Dpm 644 %{sources}/$i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i  done  %check -cd %{pecl_name}-%{version} +cd %{sources} +VER=$(%{__php} -r 'echo PHP_VERSION_ID;') +OPT="-P -q --show-diff" +if [ $VER -ge 70400 ]; then +  OPT="$OPT %{?_smp_mflags}" +fi +if [ $VER -ge 80300 ]; then +  rm tests/attributes_02.phpt +  rm tests/class_consts_80.phpt +  rm tests/php81_enums.phpt +  rm tests/php81_final_class_const.phpt +fi +  : Minimal load test for NTS extension  %{__php} --no-php-ini \      --define extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \      --modules | grep '^%{pecl_name}$'  : Upstream test suite  for NTS extension -TEST_PHP_EXECUTABLE=%{__php} \  TEST_PHP_ARGS="-n -d extension=tokenizer.so -d extension=%{buildroot}%{php_extdir}/%{pecl_name}.so" \ -REPORT_EXIT_STATUS=1 \ -%{__php} -n run-tests.php -q --show-diff +%{__php} -n run-tests.php $OPT  %if %{with_zts}  : Minimal load test for ZTS extension @@ -139,10 +156,8 @@ REPORT_EXIT_STATUS=1 \      --modules | grep '^%{pecl_name}$'  : Upstream test suite  for ZTS extension -TEST_PHP_EXECUTABLE=%{__ztsphp} \  TEST_PHP_ARGS="-n -d extension=tokenizer.so -d extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so" \ -REPORT_EXIT_STATUS=1 \ -%{__ztsphp} -n run-tests.php -q --show-diff +%{__ztsphp} -n run-tests.php $OPT  %endif @@ -167,7 +182,7 @@ fi  %files -%{?_licensedir:%license %{pecl_name}-%{version}/LICENSE} +%{?_licensedir:%license %{sources}/LICENSE}  %doc %{pecl_docdir}/%{pecl_name}  %{pecl_xmldir}/%{name}.xml @@ -181,6 +196,9 @@ fi  %changelog +* Mon Oct  2 2023 Remi Collet <remi@remirepo.net> - 1.1.0-4 +- ignore 4 test failing with 8.3 +  * Wed Mar 15 2023 Remi Collet <remi@remirepo.net> - 1.1.0-3  - build out of sources tree  | 
