From a678ff843970d048120ae3f05928517dc3dbc66d Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 20 Jul 2023 11:37:04 +0200 Subject: build out of sources tree --- php-pecl-ssdeep.spec | 100 ++++++++++++++++++++++++--------------------------- 1 file changed, 46 insertions(+), 54 deletions(-) (limited to 'php-pecl-ssdeep.spec') diff --git a/php-pecl-ssdeep.spec b/php-pecl-ssdeep.spec index 69af076..38f9a92 100644 --- a/php-pecl-ssdeep.spec +++ b/php-pecl-ssdeep.spec @@ -3,8 +3,8 @@ # # Fedora spec file for php-pecl-ssdeep # -# Copyright (c) 2014-2021 Remi Collet -# License: CC-BY-SA +# Copyright (c) 2014-2023 Remi Collet +# License: CC-BY-SA-4.0 # http://creativecommons.org/licenses/by-sa/4.0/ # # Please, preserve the changelog entries @@ -14,25 +14,34 @@ %undefine _strict_symbol_defs_build %if 0%{?scl:1} -%global sub_prefix %{scl_prefix} %scl_package php-pecl-ssdeep %else %global _root_prefix %{_prefix} %endif -%global with_zts 0%{!?_without_zts:%{?__ztsphp:1}} -%global pecl_name ssdeep +%bcond_without tests + +%global with_zts 0%{!?_without_zts:%{?__ztsphp:1}} +%global pecl_name ssdeep %if "%{php_version}" < "5.6" -%global ini_name %{pecl_name}.ini +%global ini_name %{pecl_name}.ini %else -%global ini_name 40-%{pecl_name}.ini +%global ini_name 40-%{pecl_name}.ini %endif +%global sources %{pecl_name}-%{version} +%global _configure ../%{sources}/configure + +# 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} Summary: Wrapper for libfuzzy library -Name: %{?sub_prefix}php-pecl-%{pecl_name} +Name: %{?scl_prefix}php-pecl-%{pecl_name} Version: 1.1.0 -Release: 11%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} -License: BSD +Release: 12%{?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}.tgz @@ -46,33 +55,11 @@ BuildRequires: ssdeep-devel > 2.5 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} Provides: %{?scl_prefix}php-pecl(%{pecl_name}) = %{version} Provides: %{?scl_prefix}php-pecl(%{pecl_name})%{?_isa} = %{version} -Provides: %{?scl_prefix}php-pecl-%{pecl_name} = %{version}-%{release} -Provides: %{?scl_prefix}php-pecl-%{pecl_name}%{?_isa} = %{version}-%{release} - -%if "%{?packager}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel} -# Other third party repo stuff -%if "%{php_version}" > "7.2" -Obsoletes: php72u-pecl-%{pecl_name} <= %{version} -%endif -%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 @@ -95,7 +82,6 @@ Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSIO %prep %setup -q -c -mv %{pecl_name}-%{version} NTS [ -f package2.xml ] && mv package2.xml package.xml # Don't install/register tests @@ -103,8 +89,8 @@ sed -e 's/role="test"/role="src"/' \ %{?_licensedir:-e '/LICENSE/s/role="doc"/role="src"/' } \ -i package.xml -pushd NTS -%patch0 -p1 -b .pr2 +pushd %{sources} +%patch -P0 -p1 -b .pr2 # Sanity check, really often broken extver=$(sed -n '/# *define PHP_SSDEEP_VERSION/{s/.* "//;s/".*$//;p}' php_ssdeep.h) @@ -114,9 +100,9 @@ if test "x${extver}" != "x%{version}%{?versuf}"; then fi popd +mkdir NTS %if %{with_zts} -# Duplicate source tree for NTS / ZTS build -cp -pr NTS ZTS +mkdir ZTS %endif # Create configuration file @@ -129,20 +115,21 @@ EOF %build %{?dtsenable} -cd NTS -%{_bindir}/phpize +cd %{sources} +%{__phpize} + +cd ../NTS %configure \ --with-ssdeep=%{_root_prefix} \ - --with-php-config=%{_bindir}/php-config \ + --with-php-config=%{__phpconfig} \ --with-libdir=%{_lib} make %{?_smp_mflags} %if %{with_zts} cd ../ZTS -%{_bindir}/zts-phpize %configure \ --with-ssdeep=%{_root_prefix} \ - --with-php-config=%{_bindir}/zts-php-config \ + --with-php-config=%{__ztsphpconfig} \ --with-libdir=%{_lib} make %{?_smp_mflags} %endif @@ -167,8 +154,8 @@ 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 - sed -e 's/\r//' -i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i +do install -Dpm 644 %{sources}/$i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i + sed -e 's/\r//' -i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i done @@ -193,37 +180,39 @@ fi %check -cd NTS +cd %{sources} + : Minimal load test for NTS extension %{__php} --no-php-ini \ --define extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \ --modules | grep '^%{pecl_name}$' +%if %{with tests} : Upstream test suite for NTS extension TEST_PHP_EXECUTABLE=%{__php} \ -TEST_PHP_ARGS="-n -d extension=$PWD/modules/%{pecl_name}.so" \ -NO_INTERACTION=1 \ +TEST_PHP_ARGS="-n -d extension=$PWD/../NTS/modules/%{pecl_name}.so" \ REPORT_EXIT_STATUS=1 \ -%{__php} -n run-tests.php +%{__php} -n run-tests.php -q --show-diff +%endif %if %{with_zts} -cd ../ZTS : Minimal load test for ZTS extension %{__ztsphp} --no-php-ini \ --define extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \ --modules | grep '^%{pecl_name}$' +%if %{with tests} : Upstream test suite for ZTS extension -TEST_PHP_EXECUTABLE=%{_bindir}/zts-php \ -TEST_PHP_ARGS="-n -d extension=$PWD/modules/%{pecl_name}.so" \ -NO_INTERACTION=1 \ +TEST_PHP_EXECUTABLE=%{__ztsphp} \ +TEST_PHP_ARGS="-n -d extension=$PWD/../ZTS/modules/%{pecl_name}.so" \ REPORT_EXIT_STATUS=1 \ -%{_bindir}/zts-php -n run-tests.php +%{__ztsphp} -n run-tests.php -q --show-diff +%endif %endif %files -%{?_licensedir:%license NTS/LICENSE} +%{?_licensedir:%license %{sources}/LICENSE} %doc %{pecl_docdir}/%{pecl_name} %{pecl_xmldir}/%{name}.xml %config(noreplace) %{php_inidir}/%{ini_name} @@ -236,6 +225,9 @@ REPORT_EXIT_STATUS=1 \ %changelog +* Thu Jul 20 2023 Remi Collet - 1.1.0-12 +- build out of sources tree + * Wed Sep 01 2021 Remi Collet - 1.1.0-11 - rebuild for 8.1.0RC1 -- cgit