From 1f692ed930ffa834a2cede10347e5a1d6fc3d742 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 15 Mar 2023 16:45:23 +0100 Subject: build out of sources tree --- php-ast.spec | 48 ++++++++++++++++-------------------------------- 1 file changed, 16 insertions(+), 32 deletions(-) diff --git a/php-ast.spec b/php-ast.spec index a887b6a..8ac9371 100644 --- a/php-ast.spec +++ b/php-ast.spec @@ -8,12 +8,6 @@ # %{?scl: %scl_package php-ast} -%global gh_commit 701e8539e0a861b8fe3c0144a7554c376f42efe3 -%global gh_short %(c=%{gh_commit}; echo ${c:0:7}) -%global gh_owner nikic -%global gh_project php-ast -#global gh_date 20160608 - %global pecl_name ast %global with_zts 0%{!?_without_zts:%{?__ztsphp:1}} # After 20-tokenizer.ini @@ -22,18 +16,10 @@ Summary: Abstract Syntax Tree Name: %{?scl_prefix}php-ast Version: 1.1.0 -%if 0%{?gh_date:1} -Release: 0.8.%{gh_date}git%{gh_short}%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} -%else -Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} -%endif +Release: 3%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} License: BSD-3-Clause URL: https://pecl.php.net/package/ast -%if 0%{?gh_date} -Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}-%{gh_short}.tar.gz -%else Source0: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz -%endif BuildRequires: make BuildRequires: %{?dtsprefix}gcc @@ -61,30 +47,24 @@ Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSIO %prep %setup -qc -%if 0%{?gh_date} -mv %{gh_project}-%{gh_commit} NTS -mv NTS/package.xml . -%else -mv %{pecl_name}-%{version} NTS -%endif # 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 %{pecl_name}-%{version} # Sanity check, really often broken extver=$(sed -n '/#define PHP_AST_VERSION/{s/.* "//;s/".*$//;p}' php_ast.h) -if test "x${extver}" != "x%{version}%{?gh_date:-dev}"; then - : Error: Upstream extension version is ${extver}, expecting %{version}%{?gh_date:-dev}. +if test "x${extver}" != "x%{version}"; then + : Error: Upstream extension version is ${extver}, expecting %{version}. exit 1 fi cd .. +mkdir NTS %if %{with_zts} -# duplicate for ZTS build -cp -pr NTS ZTS +mkdir ZTS %endif # Drop in the bit of configuration @@ -93,12 +73,15 @@ cat << 'EOF' | tee %{ini_name} extension = %{pecl_name}.so EOF +%global _configure ../%{pecl_name}-%{version}/configure %build %{?dtsenable} -cd NTS +cd %{pecl_name}-%{version} %{_bindir}/phpize + +cd ../NTS %configure \ --with-php-config=%{_bindir}/php-config \ --enable-ast @@ -106,7 +89,6 @@ make %{?_smp_mflags} %if %{with_zts} cd ../ZTS -%{_bindir}/zts-phpize %configure \ --with-php-config=%{_bindir}/zts-php-config \ --enable-ast @@ -132,13 +114,13 @@ 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 %{pecl_name}-%{version}/$i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i done %check -cd NTS +cd %{pecl_name}-%{version} : Minimal load test for NTS extension %{__php} --no-php-ini \ --define extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \ @@ -151,7 +133,6 @@ REPORT_EXIT_STATUS=1 \ %{__php} -n run-tests.php -q --show-diff %if %{with_zts} -cd ../ZTS : Minimal load test for ZTS extension %{__ztsphp} --no-php-ini \ --define extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \ @@ -186,7 +167,7 @@ fi %files -%{?_licensedir:%license NTS/LICENSE} +%{?_licensedir:%license %{pecl_name}-%{version}/LICENSE} %doc %{pecl_docdir}/%{pecl_name} %{pecl_xmldir}/%{name}.xml @@ -200,6 +181,9 @@ fi %changelog +* Wed Mar 15 2023 Remi Collet - 1.1.0-3 +- build out of sources tree + * Thu Sep 1 2022 Remi Collet - 1.1.0-2 - rebuild for PHP 8.2.0RC1 -- cgit