From 153a551ea34a48715937bd8e23cb04c5f367e3de Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 10 Jul 2024 16:54:56 +0200 Subject: add upstream patch for PHP 8.4 --- php-pecl-yaf.spec | 34 ++++++++++++------------------ yaf-upstream.patch | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 20 deletions(-) create mode 100644 yaf-upstream.patch diff --git a/php-pecl-yaf.spec b/php-pecl-yaf.spec index 2157fc0..50109f8 100644 --- a/php-pecl-yaf.spec +++ b/php-pecl-yaf.spec @@ -15,31 +15,23 @@ %global gh_short %(c=%{gh_commit}; echo ${c:0:7}) %global gh_owner laruence %global gh_project yaf -#global gh_date 20150914 %global with_zts 0%{!?_without_zts:%{?__ztsphp:1}} %global pecl_name yaf %global ini_name 40-%{pecl_name}.ini -%if 0%{?gh_date:1} -%global sources %{gh_project}-%{gh_commit} -%else %global sources %{pecl_name}-%{version} -%endif %global _configure ../%{sources}/configure Summary: Yet Another Framework Name: %{?scl_prefix}php-pecl-yaf Version: 3.3.6 -%if 0%{?gh_date:1} -Release: 0.13.%{gh_date}git%{gh_short}%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} -Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{sources}-%{gh_short}.tar.gz -%else -Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} -Source: https://pecl.php.net/get/%{sources}%{?prever}.tgz -%endif -License: PHP +Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +License: PHP-3.01 URL: https://pecl.php.net/package/yaf +Source0: https://pecl.php.net/get/%{sources}%{?prever}.tgz Source1: %{pecl_name}.ini +Patch0: %{pecl_name}-upstream.patch + BuildRequires: make BuildRequires: %{?dtsprefix}gcc BuildRequires: %{?scl_prefix}php-devel >= 7.0 @@ -66,20 +58,19 @@ Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSIO %prep %setup -qc -%if 0%{?gh_date:1} -mv %{sources}/package.xml . -%endif # Don't install/register tests sed -e 's/role="test"/role="src"/' \ - %{?_licensedir:-e '/LICENSE/s/role="doc"/role="src"/' } \ + -e '/LICENSE/s/role="doc"/role="src"/' \ -i package.xml cd %{sources} +%patch -P0 -p1 + # Sanity check, really often broken extver=$(sed -n '/#define PHP_YAF_VERSION/{s/.*\t"//;s/".*$//;p}' php_yaf.h ) -if test "x${extver}" != "x%{version}%{?gh_date:-dev}"; then - : Error: Upstream extension version is ${extver}, expecting %{version}%{?gh_date:-dev}. +if test "x${extver}" != "x%{version}"; then + : Error: Upstream extension version is ${extver}, expecting %{version}. exit 1 fi cd .. @@ -166,7 +157,7 @@ REPORT_EXIT_STATUS=1 \ %files -%{?_licensedir:%license %{sources}/LICENSE} +%license %{sources}/LICENSE %doc %{pecl_docdir}/%{pecl_name} %{pecl_xmldir}/%{name}.xml @@ -180,6 +171,9 @@ REPORT_EXIT_STATUS=1 \ %changelog +* Wed Jul 10 2024 Remi Collet - 3.3.6-2 +- add upstream patch for PHP 8.4 + * Mon Jul 1 2024 Remi Collet - 3.3.6-1 - update to 3.3.6 - drop patch merged upstream diff --git a/yaf-upstream.patch b/yaf-upstream.patch new file mode 100644 index 0000000..0b40a13 --- /dev/null +++ b/yaf-upstream.patch @@ -0,0 +1,62 @@ +From b1d252c944a8d70f0dc28415b3d67a7b3bbbf7ce Mon Sep 17 00:00:00 2001 +From: Xinchen Hui +Date: Tue, 25 Jun 2024 11:39:59 +0800 +Subject: [PATCH] Fixed build with trunk(8.4) + +--- + routes/yaf_route_regex.c | 9 ++++++++- + routes/yaf_route_rewrite.c | 9 ++++++++- + 2 files changed, 16 insertions(+), 2 deletions(-) + +diff --git a/routes/yaf_route_regex.c b/routes/yaf_route_regex.c +index 45410804..9dd0e2fe 100644 +--- a/routes/yaf_route_regex.c ++++ b/routes/yaf_route_regex.c +@@ -204,13 +204,20 @@ static int yaf_route_regex_match(yaf_route_regex_object *regex, const char *uri, + #if PHP_VERSION_ID < 70400 + php_pcre_match_impl(pce_regexp, (char*)uri, len, &matches, &subparts /* subpats */, + 0/* global */, 0/* ZEND_NUM_ARGS() >= 4 */, 0/*flags PREG_OFFSET_CAPTURE*/, 0/* start_offset */); +-#else ++#elif PHP_VERSION_ID < 80400 + { + zend_string *tmp = zend_string_init(uri, len, 0); + php_pcre_match_impl(pce_regexp, tmp, &matches, &subparts /* subpats */, + 0/* global */, 0/* ZEND_NUM_ARGS() >= 4 */, 0/*flags PREG_OFFSET_CAPTURE*/, 0/* start_offset */); + zend_string_release(tmp); + } ++#else ++ { ++ zend_string *tmp = zend_string_init(uri, len, 0); ++ php_pcre_match_impl(pce_regexp, tmp, &matches, &subparts /* subpats */, ++ 0/* global */, 0/*flags PREG_OFFSET_CAPTURE*/, 0/* start_offset */); ++ zend_string_release(tmp); ++ } + #endif + + if (!zend_hash_num_elements(Z_ARRVAL(subparts))) { +diff --git a/routes/yaf_route_rewrite.c b/routes/yaf_route_rewrite.c +index 716ae6fd..b7b4200a 100644 +--- a/routes/yaf_route_rewrite.c ++++ b/routes/yaf_route_rewrite.c +@@ -209,13 +209,20 @@ static int yaf_route_rewrite_match(yaf_route_rewrite_object *rewrite, const char + #if PHP_VERSION_ID < 70400 + php_pcre_match_impl(pce_regexp, (char*)uri, len, &matches, &subparts /* subpats */, + 0/* global */, 0/* ZEND_NUM_ARGS() >= 4 */, 0/*flags PREG_OFFSET_CAPTURE*/, 0/* start_offset */); +-#else ++#elif PHP_VERSION_ID <80400 + { + zend_string *tmp = zend_string_init(uri, len, 0); + php_pcre_match_impl(pce_regexp, tmp, &matches, &subparts /* subpats */, + 0/* global */, 0/* ZEND_NUM_ARGS() >= 4 */, 0/*flags PREG_OFFSET_CAPTURE*/, 0/* start_offset */); + zend_string_release(tmp); + } ++#else ++ { ++ zend_string *tmp = zend_string_init(uri, len, 0); ++ php_pcre_match_impl(pce_regexp, tmp, &matches, &subparts /* subpats */, ++ 0/* global */, 0/*flags PREG_OFFSET_CAPTURE*/, 0/* start_offset */); ++ zend_string_release(tmp); ++ } + #endif + + if (!zend_hash_num_elements(Z_ARRVAL(subparts))) { -- cgit