From 07504511032443ae5d6fa5740a87d60683fbf55d Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 26 Apr 2023 17:34:50 +0200 Subject: update to 5.0.3 use system libnghttp2 drop patch merged upstream fix use of system headers with system libnghttp2 using patch from https://github.com/swoole/swoole-src/pull/5038 build out of sources tree --- PHPINFO | 8 +++---- REFLECTION | 29 +++++++++++++++++++------- php-pecl-swoole5.spec | 58 +++++++++++++++++++++++++++++++++++++-------------- swoole-build.patch | 14 ------------- swoole-syslib.patch | 35 +++++++++++++++++++++++++++++++ 5 files changed, 102 insertions(+), 42 deletions(-) delete mode 100644 swoole-build.patch create mode 100644 swoole-syslib.patch diff --git a/PHPINFO b/PHPINFO index c4a0d99..d13958b 100644 --- a/PHPINFO +++ b/PHPINFO @@ -3,8 +3,8 @@ swoole Swoole => enabled Author => Swoole Team -Version => 5.0.2 -Built => Feb 6 2023 00:00:00 +Version => 5.0.3 +Built => Apr 26 2023 00:00:00 coroutine => enabled with boost asm context trace_log => enabled epoll => enabled @@ -14,13 +14,13 @@ cpu_affinity => enabled spinlock => enabled rwlock => enabled sockets => enabled -openssl => OpenSSL 3.0.5 5 Jul 2022 +openssl => OpenSSL 3.0.8 7 Feb 2023 dtls => enabled http2 => enabled json => enabled curl-native => enabled pcre => enabled -c-ares => 1.17.2 +c-ares => 1.19.0 zlib => 1.2.12 brotli => E16777225/D16777225 mutex_timedlock => enabled diff --git a/REFLECTION b/REFLECTION index b26acdd..50ec5f4 100644 --- a/REFLECTION +++ b/REFLECTION @@ -1,4 +1,4 @@ -Extension [ extension #107 swoole version 5.0.2 ] { +Extension [ extension #107 swoole version 5.0.3 ] { - Dependencies { Dependency [ json (Required) ] @@ -28,12 +28,12 @@ Extension [ extension #107 swoole version 5.0.2 ] { } } - - Constants [403] { - Constant [ string SWOOLE_VERSION ] { 5.0.2 } - Constant [ int SWOOLE_VERSION_ID ] { 50002 } + - Constants [406] { + Constant [ string SWOOLE_VERSION ] { 5.0.3 } + Constant [ int SWOOLE_VERSION_ID ] { 50003 } Constant [ int SWOOLE_MAJOR_VERSION ] { 5 } Constant [ int SWOOLE_MINOR_VERSION ] { 0 } - Constant [ int SWOOLE_RELEASE_VERSION ] { 2 } + Constant [ int SWOOLE_RELEASE_VERSION ] { 3 } Constant [ string SWOOLE_EXTRA_VERSION ] { } Constant [ bool SWOOLE_DEBUG ] { } Constant [ bool SWOOLE_HAVE_COMPRESSION ] { 1 } @@ -156,6 +156,7 @@ Extension [ extension #107 swoole version 5.0.2 ] { Constant [ int SWOOLE_ERROR_HTTP_INVALID_PROTOCOL ] { 7102 } Constant [ int SWOOLE_ERROR_HTTP_PROXY_HANDSHAKE_FAILED ] { 7103 } Constant [ int SWOOLE_ERROR_HTTP_PROXY_BAD_RESPONSE ] { 7104 } + Constant [ int SWOOLE_ERROR_HTTP_CONFLICT_HEADER ] { 7105 } Constant [ int SWOOLE_ERROR_WEBSOCKET_BAD_CLIENT ] { 8501 } Constant [ int SWOOLE_ERROR_WEBSOCKET_BAD_OPCODE ] { 8502 } Constant [ int SWOOLE_ERROR_WEBSOCKET_UNCONNECTED ] { 8503 } @@ -252,6 +253,8 @@ Extension [ extension #107 swoole version 5.0.2 ] { Constant [ int SWOOLE_SEM ] { 4 } Constant [ int SWOOLE_RWLOCK ] { 1 } Constant [ int SWOOLE_SPINLOCK ] { 5 } + Constant [ int SWOOLE_MSGQUEUE_ORIENT ] { 1 } + Constant [ int SWOOLE_MSGQUEUE_BALANCE ] { 2 } Constant [ int SWOOLE_TIMER_MIN_MS ] { 1 } Constant [ float SWOOLE_TIMER_MIN_SEC ] { 0.001 } Constant [ int SWOOLE_TIMER_MAX_MS ] { 9223372036854775807 } @@ -1829,7 +1832,7 @@ Extension [ extension #107 swoole version 5.0.2 ] { Property [ public $workers = NULL ] } - - Methods [11] { + - Methods [12] { Method [ public method __construct ] { - Parameters [4] { @@ -1889,6 +1892,15 @@ Extension [ extension #107 swoole version 5.0.2 ] { - Return [ bool ] } + Method [ public method sendMessage ] { + + - Parameters [2] { + Parameter #0 [ string $data ] + Parameter #1 [ int $dst_worker_id ] + } + - Return [ bool ] + } + Method [ public method detach ] { - Parameters [0] { @@ -7697,7 +7709,7 @@ Extension [ extension #107 swoole version 5.0.2 ] { - Static methods [0] { } - - Properties [18] { + - Properties [19] { Property [ private $onConnect = NULL ] Property [ private $onReceive = NULL ] Property [ private $onClose = NULL ] @@ -7705,10 +7717,11 @@ Extension [ extension #107 swoole version 5.0.2 ] { Property [ private $onBufferFull = NULL ] Property [ private $onBufferEmpty = NULL ] Property [ private $onRequest = NULL ] - Property [ private $onHandShake = NULL ] + Property [ private $onHandshake = NULL ] Property [ private $onOpen = NULL ] Property [ private $onMessage = NULL ] Property [ private $onDisconnect = NULL ] + Property [ private $onBeforeHandshakeResponse = NULL ] Property [ public $host = NULL ] Property [ public $port = 0 ] Property [ public $type = 0 ] diff --git a/php-pecl-swoole5.spec b/php-pecl-swoole5.spec index 156591c..8d316fb 100644 --- a/php-pecl-swoole5.spec +++ b/php-pecl-swoole5.spec @@ -40,22 +40,24 @@ %bcond_with curl %endif -%global upstream_version 5.0.2 -#global upstream_prever RC2 +%bcond_without nghttpd2 +%global upstream_version 5.0.3 +#global upstream_prever RC2 +%global sources %{pecl_name}-%{upstream_version}%{?upstream_prever} Summary: PHP's asynchronous concurrent distributed networking framework Name: %{?scl_prefix}php-pecl-%{pecl_name}5 Version: %{upstream_version}%{?upstream_prever:~%{upstream_prever}} Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} # Extension is Apache-2.0 -# Hiredis is BSD-3-Clause -# nlohmann/json is MIT +# BSD-3-Clause: Hiredis +# MIT: nlohmann/json, nghttp2 License: Apache-2.0 AND BSD-3-Clause AND MIT URL: https://pecl.php.net/package/%{pecl_name} Source0: https://pecl.php.net/get/%{pecl_name}-%{upstream_version}%{?upstream_prever}.tgz -Patch0: %{pecl_name}-build.patch +Patch0: %{pecl_name}-syslib.patch BuildRequires: make BuildRequires: %{?dtsprefix}gcc @@ -81,6 +83,9 @@ BuildRequires: brotli-devel %if %{with pgsql} BuildRequires: libpq-devel %endif +%if %{with nghttpd2} +BuildRequires: libnghttp2-devel +%endif Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api} Requires: %{?scl_prefix}php(api) = %{php_core_api} @@ -147,8 +152,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 \ @@ -160,11 +163,15 @@ sed \ -i package.xml -cd NTS -%patch0 -p1 +cd %{sources} +%patch -P0 -p1 -b .pr5038 cp -p thirdparty/hiredis/COPYING hiredis-COPYING +%if %{with nghttpd2} +rm -r thirdparty/nghttp2 +%else cp -p thirdparty/nghttp2/COPYING nghttp2-COPYING +%endif # Sanity check, really often broken extver=$(sed -n '/#define SWOOLE_VERSION /{s/.* "//;s/".*$//;p}' include/swoole_version.h) @@ -174,9 +181,10 @@ 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 @@ -194,6 +202,8 @@ extension=%{pecl_name}.so EOF +%global _configure ../%{sources}/configure + %build %{?dtsenable} @@ -216,6 +226,9 @@ peclbuild() { %endif %if %{with brotli} --enable-brotli \ +%endif +%if %{with nghttpd2} + --with-nghttp2-dir=%{_prefix} \ %endif --with-libdir=%{_lib} \ --with-php-config=$1 @@ -223,13 +236,14 @@ peclbuild() { make %{?_smp_mflags} } -cd NTS +cd %{sources} %{_bindir}/phpize + +cd ../NTS peclbuild %{_bindir}/php-config %if %{with_zts} cd ../ZTS -%{_bindir}/zts-phpize peclbuild %{_bindir}/zts-php-config %endif @@ -255,10 +269,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 @@ -309,8 +323,8 @@ cd ../ZTS %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} %doc %{pecl_docdir}/%{pecl_name}/*md @@ -340,6 +354,18 @@ cd ../ZTS %changelog +* Wed Apr 26 2023 Remi Collet - 5.0.3-1 +- update to 5.0.3 +- use system libnghttp2 +- drop patch merged upstream +- fix use of system headers with system libnghttp2 using patch from + https://github.com/swoole/swoole-src/pull/5038 +- build out of sources tree + +* Fri Feb 17 2023 Remi Collet - 5.0.2-2 +- fix GCC 13 build using patch from + https://github.com/swoole/swoole-src/pull/4985 + * Mon Feb 6 2023 Remi Collet - 5.0.2-1 - update to 5.0.2 diff --git a/swoole-build.patch b/swoole-build.patch deleted file mode 100644 index 5ee6e39..0000000 --- a/swoole-build.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff --git a/include/swoole_string.h b/include/swoole_string.h -index 4affbac81..f80890c46 100644 ---- a/include/swoole_string.h -+++ b/include/swoole_string.h -@@ -25,6 +25,9 @@ - #define SW_STRINGS(s) s->str, s->size - #define SW_STRINGCVL(s) s->str + s->offset, s->length - s->offset - -+/* see https://github.com/swoole/swoole-src/issues/4693 */ -+#pragma GCC diagnostic ignored "-Wformat-security" -+ - namespace swoole { - - typedef std::function StringExplodeHandler; diff --git a/swoole-syslib.patch b/swoole-syslib.patch new file mode 100644 index 0000000..0c58430 --- /dev/null +++ b/swoole-syslib.patch @@ -0,0 +1,35 @@ +From 27141691462ed49e42968d77192df62e89f72156 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Wed, 26 Apr 2023 17:17:43 +0200 +Subject: [PATCH] use system headers for system libnghttp2 + +--- + config.m4 | 1 + + ext-src/php_swoole_http.h | 2 +- + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/config.m4 b/config.m4 +index da62b9a704..19fb0698d3 100644 +--- a/config.m4 ++++ b/config.m4 +@@ -744,6 +744,7 @@ EOF + thirdparty/hiredis/sds.c" + + if test "$PHP_NGHTTP2_DIR" = "no"; then ++ PHP_ADD_INCLUDE([$ext_srcdir/thirdparty]) + swoole_source_file="$swoole_source_file \ + thirdparty/nghttp2/nghttp2_hd.c \ + thirdparty/nghttp2/nghttp2_rcbuf.c \ +diff --git a/ext-src/php_swoole_http.h b/ext-src/php_swoole_http.h +index b43982e5c6..717c2ee4d3 100644 +--- a/ext-src/php_swoole_http.h ++++ b/ext-src/php_swoole_http.h +@@ -34,7 +34,7 @@ + #define SW_ZLIB_ENCODING_ANY 0x2f + #endif + +-#include "thirdparty/nghttp2/nghttp2.h" ++#include + + enum swHttpHeaderFlag { + HTTP_HEADER_SERVER = 1u << 1, -- cgit