%bcond_without tests %bcond_without apcu %bcond_with libzstd %global pecl_name zstd %global with_zts 0%{!?_without_zts:%{?__ztsphp:1}} %global ini_name 40-%{pecl_name}.ini %global sources %{pecl_name}-%{version} %global _configure ../%{sources}/configure Summary: Zstandard extension Name: php-%{pecl_name} Version: 0.15.2 Release: 1.git666c9fe%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} License: MIT AND BSD-3-Clause URL: https://github.com/kjdev/php-ext-zstd Source0: zstd-%{version}.tar.gz Source1: package.xml BuildRequires: gcc BuildRequires: php-devel >= 7.0 %if %{with apcu} BuildRequires: php-pecl-apcu-devel %endif BuildRequires: php-pear %if %{with libzstd} BuildRequires: libzstd-devel >= 1.4 Requires: libzstd%{?_isa} >= 1.4 %else Provides: bundled(libzstd) = 1.5.5 %endif Requires: php(zend-abi) = %{php_zend_api} Requires: php(api) = %{php_core_api} Provides: php-pecl-%{pecl_name} = %{version} Provides: php-pecl-%{pecl_name}%{?_isa} = %{version} Provides: php-pecl(%{pecl_name}) = %{version} Provides: php-pecl(%{pecl_name})%{?_isa} = %{version} %description PHP extension for compression and decompression with Zstandard library. Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.\".\".PHP_MINOR_VERSION;') %package devel Summary: %{name} developer files (header) Requires: %{name}%{?_isa} = %{version}-%{release} Requires: php-devel%{?_isa} %description devel These are the files needed to compile programs using %{name}. %prep %setup -qc %{?_licensedir:sed -e '/LICENSE/s/role=\"doc\"/role=\"src\"/' -i package.xml} cd %{sources} %if %{with libzstd} # Use the system library rm -r zstd sed -e '\:\"zstd/:d' -i ../package.xml %else cp zstd/LICENSE LICENSE-libzstd %endif # Sanity check, really often broken extver=$(sed -n '/#define PHP_ZSTD_VERSION/{s/.* \"//;s/\".*$//;p}' php_zstd.h) if test \"x${extver}\" != \"x%{version}\"; then : Error: Upstream extension version is ${extver}, expecting %{version}. exit 1 fi cd .. mkdir NTS %if %{with_zts} mkdir ZTS %endif # Drop in the bit of configuration cat << 'EOF' | tee %{ini_name} ; Enable '%{summary}' extension module extension = %{pecl_name}.so EOF %build cd %{sources} %{__phpize} cd ../NTS %configure \ --with-php-config=%{__phpconfig} \ %if %{with libzstd} --with-libzstd \ %endif --with-libdir=%{_lib} \ --enable-zstd make %{?_smp_mflags} %if %{with_zts} cd ../ZTS %configure \ --with-php-config=%{__ztsphpconfig} \ %if %{with libzstd} --with-libzstd \ %endif --with-libdir=%{_lib} \ --enable-zstd make %{?_smp_mflags} %endif %install # Install the NTS stuff make -C NTS install INSTALL_ROOT=%{buildroot} install -D -m 644 %{ini_name} %{buildroot}%{php_inidir}/%{ini_name} # Install XML package description install -D -m 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml %if %{with_zts} # Install the ZTS stuff make -C ZTS install INSTALL_ROOT=%{buildroot} install -D -m 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name} %endif # Test & Documentation cd %{sources} for i in $(grep 'role=\"test\"' ../package.xml | sed -e 's/^.*name=\"//;s/\".*$//') do install -Dpm 644 $i %{buildroot}%{pecl_testdir}/%{pecl_name}/$i done 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 %{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 apcu} : Check that apcu is aware of zstd serializer %{__php} --no-php-ini \ --define extension=apcu.so \ --define apc.enabled=1 \ --define apc.enable_cli=1 \ --define extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \ --ri apcu | grep '%{pecl_name}' %endif %if %{with tests} : Upstream test suite for NTS extension TEST_PHP_EXECUTABLE=%{__php} \ TEST_PHP_ARGS=\"-n -d extension=%{buildroot}%{php_extdir}/%{pecl_name}.so\" \ %{__php} -n run-tests.php -q --offline --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}$' %if %{with tests} : Upstream test suite for ZTS extension TEST_PHP_EXECUTABLE=%{__ztsphp} \ TEST_PHP_ARGS=\"-n -d extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so\" \ %{__ztsphp} -n run-tests.php -q --offline --show-diff %endif %endif %files %{?_licensedir:%license %{sources}/LICENSE} %doc %{pecl_docdir}/%{pecl_name} %{pecl_xmldir}/%{name}.xml %if ! %{with libzstd} %{?_licensedir:%license %{sources}/LICENSE-libzstd} %endif %config(noreplace) %{php_inidir}/%{ini_name} %{php_extdir}/%{pecl_name}.so %if %{with_zts} %config(noreplace) %{php_ztsinidir}/%{ini_name} %{php_ztsextdir}/%{pecl_name}.so %endif %files devel %doc %{pecl_testdir}/%{pecl_name} %{php_incldir}/ext/%{pecl_name} %if %{with_zts} %{php_ztsincldir}/ext/%{pecl_name} %endif %changelog * Fri Sep 05 2025 COPR Builder - 0.15.2-1.git666c9fe - Automated build from GitHub master branch - Git commit: 666c9fe