From b8766f3b78bc9a0cc00a035b87d255a85eaeb132 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 4 Sep 2023 08:47:45 +0200 Subject: build out of sources tree add patch for PHP 8.3 from https://github.com/openswoole/ext-openswoole/pull/328 --- openswoole-php83.patch | 29 ++++++++++++++++++++++++ php-pecl-openswoole22.spec | 56 +++++++++++++++++++++++----------------------- 2 files changed, 57 insertions(+), 28 deletions(-) create mode 100644 openswoole-php83.patch diff --git a/openswoole-php83.patch b/openswoole-php83.patch new file mode 100644 index 0000000..cfc37e2 --- /dev/null +++ b/openswoole-php83.patch @@ -0,0 +1,29 @@ +From 7aef32c30f37b9278ab86a0f0b64c0e740a6d06e Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Mon, 4 Sep 2023 08:36:21 +0200 +Subject: [PATCH] fix php_url_encode_hash_ex call for 8.3 + +--- + ext-src/php_swoole_private.h | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/ext-src/php_swoole_private.h b/ext-src/php_swoole_private.h +index 08053f6c9..7bcfaaa84 100644 +--- a/ext-src/php_swoole_private.h ++++ b/ext-src/php_swoole_private.h +@@ -1041,10 +1041,14 @@ static sw_inline char *php_swoole_http_build_query(zval *zdata, size_t *length, + #if PHP_VERSION_ID < 80000 + if (php_url_encode_hash_ex( + HASH_OF(zdata), formstr, NULL, 0, NULL, 0, NULL, 0, NULL, NULL, (int) PHP_QUERY_RFC1738) == FAILURE) { +-#else ++#elif PHP_VERSION_ID < 80300 + if (HASH_OF(zdata)) { + php_url_encode_hash_ex(HASH_OF(zdata), formstr, NULL, 0, NULL, 0, NULL, 0, NULL, NULL, (int) PHP_QUERY_RFC1738); + } else { ++#else ++ if (HASH_OF(zdata)) { ++ php_url_encode_hash_ex(HASH_OF(zdata), formstr, NULL, NULL, NULL, NULL, NULL, (int) PHP_QUERY_RFC1738); ++ } else { + #endif + if (formstr->s) { + smart_str_free(formstr); diff --git a/php-pecl-openswoole22.spec b/php-pecl-openswoole22.spec index 1c5bf8e..e0980b6 100644 --- a/php-pecl-openswoole22.spec +++ b/php-pecl-openswoole22.spec @@ -7,12 +7,7 @@ # Please, preserve the changelog entries # -# we don't want -z defs linker flag -%undefine _strict_symbol_defs_build - -%if 0%{?scl:1} -%scl_package php-pecl-openswoole22 -%endif +%{?scl:%scl_package php-pecl-openswoole22} # See https://github.com/openswoole/swoole-src/issues/287 %global with_zts 0 @@ -31,19 +26,22 @@ %global upstream_version 22.0.0 #global upstream_prever RC2 +%global sources %{pecl_name}-%{upstream_version}%{?upstream_prever} +%global _configure ../%{sources}/configure Summary: High Performance Programmatic Server for PHP with Async IO, Coroutines and Fibers Name: %{?scl_prefix}php-pecl-%{pecl_name}22 Version: %{upstream_version}%{?upstream_prever:~%{upstream_prever}} -Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release: 3%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} # SPDX: extension is Apache-2.0 # hiredis is BSD-3-Clause License: Apache-2.0 AND BSD-3-Clause URL: https://pecl.php.net/package/%{pecl_name} -Source0: https://pecl.php.net/get/%{pecl_name}-%{upstream_version}%{?upstream_prever}.tgz +Source0: https://pecl.php.net/get/%{sources}.tgz Patch0: %{pecl_name}-gcc13.patch +Patch1: %{pecl_name}-php83.patch BuildRequires: make BuildRequires: %{?dtsprefix}gcc @@ -76,7 +74,6 @@ Requires: %{?scl_prefix}php(api) = %{php_core_api} Requires: %{?scl_prefix}php-curl%{?_isa} Requires: %{?scl_prefix}php-sockets%{?_isa} Requires: %{?scl_prefix}php-mysqlnd%{?_isa} -%{?_sclreq:Requires: %{?scl_prefix}runtime%{?_sclreq}%{?_isa}} Provides: %{?scl_prefix}php-%{pecl_name} = %{version} Provides: %{?scl_prefix}php-%{pecl_name}%{?_isa} = %{version} @@ -120,8 +117,6 @@ These are the files needed to compile programs using %{name}. %prep %setup -q -c -mv %{pecl_name}-%{upstream_version}%{?upstream_prever} NTS - # Don't install/register tests, install examples as doc sed \ @@ -133,8 +128,9 @@ sed \ -i package.xml -cd NTS -%patch0 -p1 -b .pr304 +cd %{sources} +%patch -P0 -p1 -b .pr304 +%patch -P1 -p1 -b .pr328 cp -p thirdparty/hiredis/COPYING hiredis-COPYING cp -p thirdparty/nghttp2/COPYING nghttp2-COPYING @@ -147,9 +143,9 @@ if test "x${extver}" != "x%{upstream_version}%{?upstream_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 @@ -189,14 +185,15 @@ peclbuild() { make %{?_smp_mflags} } -cd NTS -%{_bindir}/phpize -peclbuild %{_bindir}/php-config +cd %{sources} +%{__phpize} + +cd ../NTS +peclbuild %{__phpconfig} %if %{with_zts} cd ../ZTS -%{_bindir}/zts-phpize -peclbuild %{_bindir}/zts-php-config +peclbuild %{__ztsphpconfig} %endif @@ -221,10 +218,10 @@ install -D -m 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name} # Test and Documentation for i in $(grep 'role="test"' package.xml | sed -e 's/^.*name="//;s/".*$//') -do install -Dpm 644 NTS/$i %{buildroot}%{pecl_testdir}/%{pecl_name}/$i +do install -Dpm 644 %{sources}/$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 NTS/$i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i +do install -Dpm 644 %{sources}/$i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i done # code not compatible with Python 3 @@ -257,24 +254,22 @@ OPT="--no-php-ini" [ -f %{php_extdir}/sockets.so ] && OPT="$OPT -d extension=sockets.so" [ -f %{php_extdir}/mysqlnd.so ] && OPT="$OPT -d extension=mysqlnd.so" -cd NTS : Minimal load test for NTS extension %{__php} $OPT \ - --define extension=modules/%{pecl_name}.so \ + --define extension=NTS/modules/%{pecl_name}.so \ --modules | grep '^%{pecl_name}$' %if %{with_zts} -cd ../ZTS : Minimal load test for ZTS extension %{__ztsphp} $OPT \ - --define extension=modules/%{pecl_name}.so \ + --define extension=ZTS/modules/%{pecl_name}.so \ --modules | grep '^%{pecl_name}$' %endif %files -%{?_licensedir:%license NTS/LICENSE*} -%{?_licensedir:%license NTS/*-COPYING} +%{?_licensedir:%license %{sources}/LICENSE*} +%{?_licensedir:%license %{sources}/*-COPYING} %{!?_licensedir:%{pecl_docdir}/%{pecl_name}/LICENSE} %{!?_licensedir:%{pecl_docdir}/%{pecl_name}/thirdparty/*/COPYING} %{pecl_xmldir}/%{name}.xml @@ -304,6 +299,11 @@ cd ../ZTS %changelog +* Mon Sep 4 2023 Remi Collet - 22.0.0-3 +- build out of sources tree +- add patch for PHP 8.3 from + https://github.com/openswoole/ext-openswoole/pull/328 + * Fri Feb 17 2023 Remi Collet - 22.0.0-2 - fix GCC 13 build using patch from https://github.com/openswoole/ext-openswoole/pull/304 -- cgit