From e1c2c96e27c8c11c951cd2a9004361159b835c6e Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 17 Oct 2024 11:36:29 +0200 Subject: modernize --- php-pecl-lzf.spec | 100 +++++++++++++----------------------------------------- 1 file changed, 24 insertions(+), 76 deletions(-) diff --git a/php-pecl-lzf.spec b/php-pecl-lzf.spec index e4f50f3..cf361ff 100644 --- a/php-pecl-lzf.spec +++ b/php-pecl-lzf.spec @@ -8,18 +8,14 @@ # # Please preserve changelog entries # -%if 0%{?scl:1} -%scl_package php-pecl-lzf -%endif +%{?scl:%scl_package php-pecl-lzf} %global pecl_name LZF %global ext_name lzf %global with_zts 0%{!?_without_zts:%{?__ztsphp:1}} -%if "%{php_version}" < "5.6" -%global ini_name %{ext_name}.ini -%else %global ini_name 40-%{ext_name}.ini -%endif +%global sources %{pecl_name}-%{version} +%global _configure ../%{sources}/configure Name: %{?scl_prefix}php-pecl-lzf Version: 1.7.0 @@ -28,7 +24,7 @@ Summary: Extension to handle LZF de/compression Group: Development/Languages License: PHP-3.01 URL: https://pecl.php.net/package/%{pecl_name} -Source0: https://pecl.php.net/get/%{pecl_name}-%{version}.tgz +Source0: https://pecl.php.net/get/%{sources}.tgz BuildRequires: make BuildRequires: %{?dtsprefix}gcc @@ -44,31 +40,6 @@ Provides: %{?scl_prefix}php-%{ext_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 -Obsoletes: php53-pecl-%{ext_name} <= %{version} -Obsoletes: php53u-pecl-%{ext_name} <= %{version} -Obsoletes: php54-pecl-%{ext_name} <= %{version} -Obsoletes: php54w-pecl-%{ext_name} <= %{version} -Obsoletes: php55u-pecl-%{ext_name} <= %{version} -Obsoletes: php56u-pecl-%{ext_name} <= %{version} -Obsoletes: php70u-pecl-%{ext_name} <= %{version} -Obsoletes: php71u-pecl-%{ext_name} <= %{version} -Obsoletes: php72u-pecl-%{ext_name} <= %{version} -%if "%{php_version}" > "7.3" -Obsoletes: php73-pecl-%{ext_name} <= %{version} -%endif -%if "%{php_version}" > "7.4" -Obsoletes: php74-pecl-%{ext_name} <= %{version} -%endif -%if "%{php_version}" > "8.0" -Obsoletes: php80-pecl-%{ext_name} <= %{version} -%endif -%if "%{php_version}" > "8.1" -Obsoletes: php81-pecl-%{ext_name} <= %{version} -%endif -%endif - %description This extension provides LZF compression and decompression using the liblzf @@ -88,11 +59,10 @@ Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSIO # Don't install/register tests sed -e 's/role="test"/role="src"/' \ -e '/name="lib/d' \ - %{?_licensedir:-e '/LICENSE/s/role="doc"/role="src"/' } \ + -e '/LICENSE/s/role="doc"/role="src"/' \ -i package.xml -mv %{pecl_name}-%{version} NTS -cd NTS +cd %{sources} rm -r lib/ extver=$(sed -n '/#define PHP_LZF_VERSION/{s/.* "//;s/".*$//;p}' php_lzf.h) @@ -102,9 +72,7 @@ if test "x${extver}" != "x%{version}%{?prever}"; then fi cd .. -%if %{with_zts} -cp -r NTS ZTS -%endif +mkdir NTS ZTS cat >%{ini_name} << 'EOF' ; Enable %{pecl_name} extension module @@ -115,29 +83,34 @@ EOF %build %{?dtsenable} -cd NTS -%{_bindir}/phpize +cd %{sources} +%{__phpize} +[ -f Makefile.global ] && GLOBAL=Makefile.global || GLOBAL=build/Makefile.global +sed -e 's/INSTALL_ROOT/DESTDIR/' -i $GLOBAL + +cd ../NTS %configure \ --enable-lzf \ --with-liblzf \ - --with-php-config=%{_bindir}/php-config -make %{?_smp_mflags} + --with-php-config=%{__phpconfig} + +%make_build %if %{with_zts} cd ../ZTS -%{_bindir}/zts-phpize %configure \ --enable-lzf \ --with-liblzf \ - --with-php-config=%{_bindir}/zts-php-config -make %{?_smp_mflags} + --with-php-config=%{__ztsphpconfig} + +%make_build %endif %install %{?dtsenable} -make install -C NTS INSTALL_ROOT=%{buildroot} +%make_install -C NTS # Drop in the bit of configuration install -D -m 644 %{ini_name} %{buildroot}%{php_inidir}/%{ini_name} @@ -146,19 +119,19 @@ install -D -m 644 %{ini_name} %{buildroot}%{php_inidir}/%{ini_name} install -D -m 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml %if %{with_zts} -make install -C ZTS INSTALL_ROOT=%{buildroot} +%make_install -C ZTS install -D -m 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name} %endif # Documentation -cd NTS +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 %check -cd NTS +cd %{sources} : Minimal load test for NTS extension %{__php} --no-php-ini \ --define extension=%{buildroot}/%{php_extdir}/%{ext_name}.so \ @@ -169,40 +142,15 @@ cd NTS -d extension=%{buildroot}%{php_extdir}/%{ext_name}.so %if %{with_zts} -cd ../ZTS : Minimal load test for ZTS extension %{__ztsphp} --no-php-ini \ --define extension=%{buildroot}/%{php_ztsextdir}/%{ext_name}.so \ --modules | grep '^%{ext_name}$' - -%{__ztsphp} -n run-tests.php \ - -n -P -q \ - -d extension_dir=modules \ - -d extension=%{buildroot}%{php_ztsextdir}/%{ext_name}.so -%endif - -%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 %files -%{?_licensedir:%license NTS/LICENSE} +%license %{sources}/LICENSE %doc %{pecl_docdir}/%{pecl_name} %{pecl_xmldir}/%{name}.xml -- cgit