# we dont want -z defs linker flag %undefine _strict_symbol_defs_build %global pecl_name hpack %global with_zts 0%{!?_without_zts:%{?__ztsphp:1}} %global ini_name 40-%{pecl_name}.ini Name: php-%{pecl_name} Version: 1.1.1 Release: 1%{?dist} Summary: HPACK header compression extension for PHP (RFC 7541) License: MIT URL: https://github.com/DigitalCyberSoft/php-hpack Source0: php-hpack-%{version}.tar.gz BuildRequires: gcc BuildRequires: make BuildRequires: php-devel >= 8.0 BuildRequires: libnghttp2-devel Requires: php(zend-abi) = %{php_zend_api} Requires: php(api) = %{php_core_api} Requires: libnghttp2 >= 1.0 %description PHP extension for HPACK header compression as defined in RFC 7541. HPACK is the header compression format used by HTTP/2. Wraps libnghttp2 to provide high-performance HPACK encoding and decoding with dynamic table support, automatic sensitive header protection, and standalone Huffman encoding/decoding functions. %package devel Summary: Development files for %{name} Requires: %{name}%{?_isa} = %{version}-%{release} Requires: php-devel%{?_isa} %description devel These are the files needed to compile programs using %{name}. %prep %setup -q -n php-hpack-%{version} # Sanity check extver=$(sed -n '/#define PHP_HPACK_VERSION/{s/.* "//;s/".*$//;p}' php_hpack.h) if test "x${extver}" != "x%{version}"; then : Error: Upstream extension version is ${extver}, expecting %{version}. exit 1 fi %if %{with_zts} # Duplicate for ZTS build cp -pr . ../ZTS %endif %build # NTS build %{_bindir}/phpize %configure \ --with-php-config=%{_bindir}/php-config \ --with-libdir=%{_lib} \ --enable-hpack make %{?_smp_mflags} %if %{with_zts} # ZTS build cd ../ZTS %{_bindir}/zts-phpize %configure \ --with-php-config=%{_bindir}/zts-php-config \ --with-libdir=%{_lib} \ --enable-hpack make %{?_smp_mflags} %endif %install # Install NTS extension make install INSTALL_ROOT=%{buildroot} # Install config file install -d %{buildroot}%{php_inidir} cat > %{buildroot}%{php_inidir}/%{ini_name} << EOF ; Enable hpack extension module extension = %{pecl_name}.so EOF %if %{with_zts} # Install ZTS extension cd ../ZTS make install INSTALL_ROOT=%{buildroot} # Install ZTS config file install -d %{buildroot}%{php_ztsinidir} cp %{buildroot}%{php_inidir}/%{ini_name} \ %{buildroot}%{php_ztsinidir}/%{ini_name} %else # Remove any ZTS files that NTS make install may have created find %{buildroot} -name "%{pecl_name}.so" -not -path "%{buildroot}%{php_extdir}/*" -delete 2>/dev/null || : %endif # Install headers for devel package install -d %{buildroot}%{php_incldir}/ext/%{pecl_name} cp -p php_hpack.h %{buildroot}%{php_incldir}/ext/%{pecl_name}/ %check # Minimal load test for NTS extension %{__php} --no-php-ini \ --define extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \ --modules | grep "^%{pecl_name}$" # Upstream test suite for NTS extension TEST_PHP_EXECUTABLE=%{__php} \ TEST_PHP_ARGS="-n -d extension=%{buildroot}%{php_extdir}/%{pecl_name}.so" \ REPORT_EXIT_STATUS=1 \ %{__php} -n run-tests.php -q --show-diff %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}$" # Upstream test suite for ZTS extension cd ../ZTS TEST_PHP_EXECUTABLE=%{__ztsphp} \ TEST_PHP_ARGS="-n -d extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so" \ REPORT_EXIT_STATUS=1 \ %{__ztsphp} -n run-tests.php -q --show-diff %endif %files %license LICENSE %doc README.md %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 %{php_incldir}/ext/%{pecl_name} %changelog * Mon Apr 06 2026 COPR Builder - 1.1.1-1 - Automated build from GitHub release 1.1.1 - HPACK header compression for HTTP/2 (RFC 7541) - Supports both NTS and ZTS builds