From df6bc05e95a20a6c093e1589d31e3ac544150f53 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 13 Jul 2023 14:45:25 +0200 Subject: build out of sources tree open https://github.com/arnaud-lb/php-memory-profiler/issues/93 license clarification --- php-pecl-memprof.spec | 94 +++++++++++++++++++++------------------------------ 1 file changed, 39 insertions(+), 55 deletions(-) diff --git a/php-pecl-memprof.spec b/php-pecl-memprof.spec index 46fe3fb..ccb6287 100644 --- a/php-pecl-memprof.spec +++ b/php-pecl-memprof.spec @@ -3,8 +3,8 @@ # # Fedora spec file for php-pecl-memprof # -# Copyright (c) 2013-2022 Remi Collet -# License: CC-BY-SA +# Copyright (c) 2013-2023 Remi Collet +# License: CC-BY-SA-4.0 # http://creativecommons.org/licenses/by-sa/4.0/ # # Please, preserve the changelog entries @@ -17,25 +17,22 @@ %bcond_without tests %endif -# we don't want -z defs linker flag -%undefine _strict_symbol_defs_build - -%if 0%{?scl:1} -%global sub_prefix %{scl_prefix} -%scl_package php-pecl-memprof -%endif +%{?scl:%scl_package php-pecl-memprof} # ZTS build is broken # https://github.com/arnaud-lb/php-memory-profiler/pull/7 -%global with_zts 0 -%global pecl_name memprof -%global ini_name 40-%{pecl_name}.ini +%global with_zts 0 +%global pecl_name memprof +%global ini_name 40-%{pecl_name}.ini +%global sources %{pecl_name}-%{version} +%global _configure ../%{sources}/configure Summary: Memory usage profiler -Name: %{?sub_prefix}php-pecl-%{pecl_name} +Name: %{?scl_prefix}php-pecl-%{pecl_name} Version: 3.0.2 -Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} -License: BSD +Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +# see https://github.com/arnaud-lb/php-memory-profiler/issues/93 +License: MIT URL: https://pecl.php.net/package/%{pecl_name} Source0: https://pecl.php.net/get/%{pecl_name}-%{version}.tgz @@ -47,29 +44,12 @@ BuildRequires: Judy-devel 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} -%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 Memprof is a fast and accurate memory profiler that can be used @@ -80,14 +60,13 @@ Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSIO %prep %setup -q -c -mv %{pecl_name}-%{version} NTS # Don't install 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_MEMPROF_VERSION/{s/.* "//;s/".*$//;p}' php_memprof.h) if test "x${extver}" != "x%{version}%{?prever:-%{prever}}"; then @@ -96,9 +75,10 @@ if test "x${extver}" != "x%{version}%{?prever:-%{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 @@ -114,20 +94,21 @@ EOF %build %{?dtsenable} -cd NTS -%{_bindir}/phpize +cd %{sources} +%{__phpize} + +cd ../NTS %configure \ --with-libdir=%{_lib} \ - --with-php-config=%{_bindir}/php-config + --with-php-config=%{__phpconfig} make %{?_smp_mflags} %if %{with_zts} cd ../ZTS -%{_bindir}/zts-phpize %configure \ --with-libdir=%{_lib} \ - --with-php-config=%{_bindir}/zts-php-config + --with-php-config=%{__ztsphpconfig} make %{?_smp_mflags} %endif @@ -151,8 +132,9 @@ install -D -m 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name} %endif # 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 +cd %{sources} +for i in $(grep 'role="doc"' ../package.xml | sed -e 's/^.*name="//;s/".*$//') +do install -Dpm 644 $i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i done @@ -179,45 +161,42 @@ fi %check # Unusable -rm ?TS/tests/autodump-xdebug.phpt +cd %{sources} +rm tests/autodump-xdebug.phpt : Minimal load test for NTS extension -%{_bindir}/php --no-php-ini \ +%{__php} --no-php-ini \ --define extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \ - --modules | grep %{pecl_name} + --modules | grep '^%{pecl_name}$' %if %{with tests} -cd NTS -grep "HAVE_MALLOC_HOOKS 1" config.h && export MEMPROF_EXPECT_NATIVE_TRACKING=1 +grep "HAVE_MALLOC_HOOKS 1" ../NTS/config.h && export MEMPROF_EXPECT_NATIVE_TRACKING=1 : Upstream test suite for NTS extension -TEST_PHP_EXECUTABLE=%{_bindir}/php \ +TEST_PHP_EXECUTABLE=%{__php} \ TEST_PHP_ARGS="-n -d extension=%{buildroot}%{php_extdir}/%{pecl_name}.so" \ -NO_INTERACTION=1 \ REPORT_EXIT_STATUS=1 \ -%{_bindir}/php -n run-tests.php --show-diff +%{_bindir}/php -n run-tests.php -q --show-diff %endif %if %{with_zts} : Minimal load test for ZTS extension %{__ztsphp} --no-php-ini \ --define extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \ - --modules | grep %{pecl_name} + --modules | grep '^%{pecl_name}$' %if %{with tests} -cd ../NTS : Upstream test suite for ZTS extension TEST_PHP_EXECUTABLE=%{__ztsphp} \ TEST_PHP_ARGS="-n -d extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so" \ -NO_INTERACTION=1 \ REPORT_EXIT_STATUS=1 \ -%{__ztsphp} -n run-tests.php --show-diff +%{__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 @@ -231,6 +210,11 @@ REPORT_EXIT_STATUS=1 \ %changelog +* Thu Jul 13 2023 Remi Collet - 3.0.2-2 +- build out of sources tree +- open https://github.com/arnaud-lb/php-memory-profiler/issues/93 + license clarification + * Fri Jan 7 2022 Remi Collet - 3.0.2-1 - update to 3.0.2 - drop patches merged upstream -- cgit