From c7537a22ba77e92e6065a027875a64a300a1ba7d Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 13 Sep 2022 11:16:46 +0200 Subject: add patch for PHP 8.2 from https://github.com/jbboehr/php-mustache/pull/67 --- .gitignore | 2 ++ mustache-php82.patch | 42 +++++++++++++++++++++++++++++++++++++++ php-pecl-mustache.spec | 54 +++++++++++++++++--------------------------------- 3 files changed, 62 insertions(+), 36 deletions(-) create mode 100644 mustache-php82.patch diff --git a/.gitignore b/.gitignore index 1ab5c4f..01f0400 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ +clog package-*.xml *.tgz +*.tar.bz2 *.tar.gz *.tar.xz *.tar.xz.asc diff --git a/mustache-php82.patch b/mustache-php82.patch new file mode 100644 index 0000000..9e40b5c --- /dev/null +++ b/mustache-php82.patch @@ -0,0 +1,42 @@ +From 4b998185887213029616163c6fa336d6a985ff06 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Tue, 13 Sep 2022 11:06:35 +0200 +Subject: [PATCH] fix __toString return type for PHP 8.2 + +--- + mustache_ast.cpp | 4 ++++ + mustache_template.cpp | 4 ++++ + 2 files changed, 8 insertions(+) + +diff --git a/mustache_ast.cpp b/mustache_ast.cpp +index eb0ba06..70abc4b 100644 +--- a/mustache_ast.cpp ++++ b/mustache_ast.cpp +@@ -24,7 +24,11 @@ ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO_EX(MustacheAST__toArray_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) + ZEND_END_ARG_INFO() + ++#if PHP_VERSION_ID >= 80200 ++ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(MustacheAST____toString_args, 0, 0, IS_STRING, 0) ++#else + ZEND_BEGIN_ARG_INFO_EX(MustacheAST____toString_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) ++#endif + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(MustacheAST____wakeup_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +diff --git a/mustache_template.cpp b/mustache_template.cpp +index e25ab24..7cd47a6 100644 +--- a/mustache_template.cpp ++++ b/mustache_template.cpp +@@ -17,7 +17,11 @@ ZEND_BEGIN_ARG_INFO_EX(MustacheTemplate____construct_args, ZEND_SEND_BY_VAL, ZEN + ZEND_ARG_INFO(0, vars) + ZEND_END_ARG_INFO() + ++#if PHP_VERSION_ID >= 80200 ++ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(MustacheTemplate____toString_args, 0, 0, IS_STRING, 0) ++#else + ZEND_BEGIN_ARG_INFO_EX(MustacheTemplate____toString_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) ++#endif + ZEND_END_ARG_INFO() + /* }}} */ + diff --git a/php-pecl-mustache.spec b/php-pecl-mustache.spec index 884f892..6718440 100644 --- a/php-pecl-mustache.spec +++ b/php-pecl-mustache.spec @@ -1,34 +1,37 @@ # remirepo spec file for php-pecl-mustache # -# Copyright (c) 2017-2020 Remi Collet +# Copyright (c) 2017-2022 Remi Collet # License: CC-BY-SA # http://creativecommons.org/licenses/by-sa/4.0/ # # Please, preserve the changelog entries # %if 0%{?scl:1} -%global sub_prefix %{scl_prefix} %scl_package php-pecl-mustache %endif -%global pecl_name mustache +%bcond_without tests + +%global pecl_name mustache %global with_zts 0%{!?_without_zts:%{?__ztsphp:1}} %global ini_name 40-%{pecl_name}.ini -%global with_tests 0%{!?_without_tests:1} %global upstream_version 0.9.2 #global upstream_prever RC2 Summary: Mustache templating language -Name: %{?sub_prefix}php-pecl-%{pecl_name} +Name: %{?scl_prefix}php-pecl-%{pecl_name} Version: %{upstream_version}%{?upstream_prever:~%{upstream_prever}} -Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} License: 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}-php82.patch + +BuildRequires: make BuildRequires: %{?dtsprefix}gcc -BuildRequires: %{?scl_prefix}php-devel >= 7 +BuildRequires: %{?scl_prefix}php-devel >= 7.0 BuildRequires: %{?scl_prefix}php-pear BuildRequires: pkgconfig(mustache) >= 0.5.0 %if 0%{?rhel} == 7 @@ -45,32 +48,6 @@ Provides: %{?scl_prefix}php-%{pecl_name} = %{version} Provides: %{?scl_prefix}php-%{pecl_name}%{?_isa} = %{version} Provides: %{?scl_prefix}php-pecl(%{pecl_name}) = %{version} Provides: %{?scl_prefix}php-pecl(%{pecl_name})%{?_isa} = %{version} -%if "%{?scl_prefix}" != "%{?sub_prefix}" -Provides: %{?scl_prefix}php-pecl-%{pecl_name} = %{version}-%{release} -Provides: %{?scl_prefix}php-pecl-%{pecl_name}%{?_isa} = %{version}-%{release} -%endif - -%if "%{?packager}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel} -# Other third party repo stuff -%if "%{php_version}" > "7.2" -Obsoletes: php72u-pecl-%{pecl_name} <= %{version} -%endif -%if "%{php_version}" > "7.3" -Obsoletes: php73-pecl-%{pecl_name} <= %{version} -%endif -%if "%{php_version}" > "7.4" -Obsoletes: php74-pecl-%{pecl_name} <= %{version} -%endif -%if "%{php_version}" > "8.0" -Obsoletes: php80-pecl-%{pecl_name} <= %{version} -%endif -%endif - -%if 0%{?fedora} < 20 && 0%{?rhel} < 7 -# Filter shared private -%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$} -%{?filter_setup} -%endif %description @@ -90,6 +67,8 @@ sed -e 's/role="test"/role="src"/' \ -i package.xml cd NTS +%patch0 -p1 -b .pr67 + # Sanity check, really often broken extver=$(sed -n '/PHP_MUSTACHE_VERSION/{s/.* "//;s/".*$//;p}' php_mustache.h) if test "x${extver}" != "x%{upstream_version}%{?upstream_prever}"; then @@ -190,7 +169,7 @@ cd NTS --modules | grep %{pecl_name} -%if %{with_tests} +%if %{with tests} # Upstream test suite TEST_PHP_EXECUTABLE=%{__php} \ TEST_PHP_ARGS="-n -d extension=$PWD/modules/%{pecl_name}.so" \ @@ -206,7 +185,7 @@ cd ../ZTS --define extension=modules/%{pecl_name}.so \ --modules | grep %{pecl_name} -%if %{with_tests} +%if %{with tests} # Upstream test suite TEST_PHP_EXECUTABLE=%{__ztsphp} \ TEST_PHP_ARGS="-n -d extension=$PWD/modules/%{pecl_name}.so" \ @@ -232,8 +211,11 @@ REPORT_EXIT_STATUS=1 \ %endif -# Notice no more EL-6 build (compiler issue and segfaults) %changelog +* Tue Sep 13 2022 Remi Collet - 0.9.2-2 +- add patch for PHP 8.2 from + https://github.com/jbboehr/php-mustache/pull/67 + * Fri Nov 13 2020 Remi Collet - 0.9.2-1 - update to 0.9.2 -- cgit