From fce7dfc48bbf810d94e898419a2a997df4cba888 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 3 Dec 2020 11:06:39 +0100 Subject: add upstream patch for PHP 8 --- php-pecl-varnish.spec | 50 ++++----- varnish-php8.patch | 274 +++++++++++++++++++++++++++++++++++++++++++++++++ varnish-upstream.patch | 28 ----- 3 files changed, 294 insertions(+), 58 deletions(-) create mode 100644 varnish-php8.patch delete mode 100644 varnish-upstream.patch diff --git a/php-pecl-varnish.spec b/php-pecl-varnish.spec index 9dec7b5..d81e1fa 100644 --- a/php-pecl-varnish.spec +++ b/php-pecl-varnish.spec @@ -1,12 +1,14 @@ # remirepo spec file for php-pecl-varnish # -# Copyright (c) 2013-2018 Remi Collet +# Copyright (c) 2013-2020 Remi Collet # License: CC-BY-SA # http://creativecommons.org/licenses/by-sa/4.0/ # # Please, preserve the changelog entries # +%bcond_with tests + # we don't want -z defs linker flag %undefine _strict_symbol_defs_build @@ -19,7 +21,6 @@ %global with_zts 0%{!?_without_zts:%{?__ztsphp:1}} %global pecl_name varnish -%global with_tests %{?_with_tests:1}%{!?_with_tests:0} %if "%{php_version}" < "5.6" %global ini_name %{pecl_name}.ini %else @@ -29,10 +30,12 @@ Summary: Varnish Cache bindings Name: %{?sub_prefix}php-pecl-%{pecl_name} Version: 1.2.4 -Release: 4%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release: 5%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} License: BSD -URL: http://pecl.php.net/package/%{pecl_name} -Source0: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz +URL: https://pecl.php.net/package/%{pecl_name} +Source0: https://pecl.php.net/get/%{pecl_name}-%{version}.tgz + +Patch0: %{pecl_name}-php8.patch BuildRequires: %{?dtsprefix}gcc BuildRequires: %{?scl_prefix}php-devel @@ -40,7 +43,7 @@ BuildRequires: %{?scl_prefix}php-pear BuildRequires: %{?scl_prefix}php-hash BuildRequires: varnish-libs-devel > 3 # For tests -%if %{with_tests} +%if %{with tests} BuildRequires: varnish %endif @@ -57,38 +60,20 @@ Provides: %{?scl_prefix}php-pecl-%{pecl_name} = %{version}-%{rele Provides: %{?scl_prefix}php-pecl-%{pecl_name}%{?_isa} = %{version}-%{release} %endif -%if "%{?vendor}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel} +%if "%{?packager}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel} # Other third party repo stuff -%if "%{php_version}" > "5.6" -Obsoletes: php56u-pecl-%{pecl_name} <= %{version} -Obsoletes: php56w-pecl-%{pecl_name} <= %{version} -%endif -%if "%{php_version}" > "7.0" -Obsoletes: php70u-pecl-%{pecl_name} <= %{version} -Obsoletes: php70w-pecl-%{pecl_name} <= %{version} -%endif -%if "%{php_version}" > "7.1" -Obsoletes: php71u-pecl-%{pecl_name} <= %{version} -Obsoletes: php71w-pecl-%{pecl_name} <= %{version} -%endif %if "%{php_version}" > "7.2" Obsoletes: php72u-pecl-%{pecl_name} <= %{version} -Obsoletes: php72w-pecl-%{pecl_name} <= %{version} %endif %if "%{php_version}" > "7.3" -Obsoletes: php73-pecl-%{pecl_name} <= %{version} -Obsoletes: php73w-pecl-%{pecl_name} <= %{version} +Obsoletes: php73-pecl-%{pecl_name} <= %{version} %endif %if "%{php_version}" > "7.4" -Obsoletes: php74-pecl-%{pecl_name} <= %{version} -Obsoletes: php74w-pecl-%{pecl_name} <= %{version} +Obsoletes: php74-pecl-%{pecl_name} <= %{version} %endif +%if "%{php_version}" > "8.0" +Obsoletes: php80-pecl-%{pecl_name} <= %{version} %endif - -%if 0%{?fedora} < 20 && 0%{?rhel} < 7 -# Filter shared private -%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$} -%{?filter_setup} %endif @@ -111,6 +96,8 @@ sed -e 's/role="test"/role="src"/' \ -i package.xml cd NTS +%patch0 -p3 -b .up0 + # Sanity check, really often broken extver=$(sed -n '/#define PHP_VARNISH_VERSION/{s/.* "//;s/".*$//;p}' php_varnish.h) if test "x${extver}" != "x%{version}%{?prever:-%{prever}}"; then @@ -208,7 +195,7 @@ ret=0 --modules | grep %{pecl_name} %endif -%if %{with_tests} +%if %{with tests} cd NTS : Run a varnish server for test suite @@ -289,6 +276,9 @@ exit $ret %changelog +* Mon Aug 24 2020 Remi Collet - 1.2.4-5 +- add upstream patch for PHP 8 + * Tue Sep 03 2019 Remi Collet - 1.2.4-4 - rebuild for 7.4.0RC1 diff --git a/varnish-php8.patch b/varnish-php8.patch new file mode 100644 index 0000000..e5a8152 --- /dev/null +++ b/varnish-php8.patch @@ -0,0 +1,274 @@ +Index: php_varnish.h +=================================================================== +--- pecl/varnish/trunk/php_varnish.h 2018/07/01 11:30:53 345257 ++++ pecl/varnish/trunk/php_varnish.h 2020/08/24 14:11:30 350373 +@@ -131,6 +131,14 @@ + int authok; + }; + ++#if PHP_MAJOR_VERSION >= 8 ++#define TSRMLS_D void ++#define TSRMLS_DC ++#define TSRMLS_C ++#define TSRMLS_CC ++#define TSRMLS_FETCH() ++#endif ++ + #if PHP_MAJOR_VERSION >= 7 + struct ze_varnish_adm_obj { + struct ze_varnish_conn zvc; +Index: varnish.c +=================================================================== +--- pecl/varnish/trunk/varnish.c (révision 350372) ++++ pecl/varnish/trunk/varnish.c (copie de travail) +@@ -40,6 +40,24 @@ + + #include "varnish_lib.h" + ++/* Compatibility with PHP < 8 */ ++#if PHP_VERSION_ID < 70200 ++#undef ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX ++#endif ++ ++#ifndef ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX ++#define ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(name, return_reference, required_num_args, type, allow_null) \ ++ ZEND_BEGIN_ARG_INFO_EX(name, _unused, return_reference, required_num_args) ++#endif ++ ++#ifndef ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE ++#define ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(pass_by_ref, name, type_hint, allow_null, default_value) \ ++ ZEND_ARG_TYPE_INFO(pass_by_ref, name, type_hint, allow_null) ++#endif ++ ++/* Arginfo generated with PHP 8 */ ++#include "varnish_arginfo.h" ++ + /*ZEND_DECLARE_MODULE_GLOBALS(varnish)*/ + + /* True global resources - no need for thread safety here +@@ -70,27 +88,27 @@ + /* {{{ VarnishAdmin_methods[] + */ + const zend_function_entry VarnishAdmin_methods[] = { +- PHP_ME(VarnishAdmin, __construct, NULL, ZEND_ACC_PUBLIC) +- PHP_ME(VarnishAdmin, connect, NULL, ZEND_ACC_PUBLIC) +- PHP_ME(VarnishAdmin, auth, NULL, ZEND_ACC_PUBLIC) +- PHP_ME(VarnishAdmin, getParams, NULL, ZEND_ACC_PUBLIC) +- PHP_ME(VarnishAdmin, setParam, NULL, ZEND_ACC_PUBLIC) +- PHP_ME(VarnishAdmin, stop, NULL, ZEND_ACC_PUBLIC) +- PHP_ME(VarnishAdmin, start, NULL, ZEND_ACC_PUBLIC) +- PHP_ME(VarnishAdmin, banUrl, NULL, ZEND_ACC_PUBLIC) +- PHP_ME(VarnishAdmin, ban, NULL, ZEND_ACC_PUBLIC) +- PHP_ME(VarnishAdmin, isRunning, NULL, ZEND_ACC_PUBLIC) +- PHP_ME(VarnishAdmin, getPanic, NULL, ZEND_ACC_PUBLIC) +- PHP_ME(VarnishAdmin, clearPanic, NULL, ZEND_ACC_PUBLIC) +- PHP_ME(VarnishAdmin, setHost, NULL, ZEND_ACC_PUBLIC) +- PHP_ME(VarnishAdmin, setIdent, NULL, ZEND_ACC_PUBLIC) +- PHP_ME(VarnishAdmin, setTimeout, NULL, ZEND_ACC_PUBLIC) +- PHP_ME(VarnishAdmin, setPort, NULL, ZEND_ACC_PUBLIC) +- PHP_ME(VarnishAdmin, setSecret, NULL, ZEND_ACC_PUBLIC) +- PHP_ME(VarnishAdmin, setCompat, NULL, ZEND_ACC_PUBLIC) +- PHP_ME(VarnishAdmin, getVclList, NULL, ZEND_ACC_PUBLIC) +- PHP_ME(VarnishAdmin, vclUse, NULL, ZEND_ACC_PUBLIC) +- PHP_ME(VarnishAdmin, disconnect, NULL, ZEND_ACC_PUBLIC) ++ PHP_ME(VarnishAdmin, __construct, arginfo_class_VarnishAdmin___construct, ZEND_ACC_PUBLIC) ++ PHP_ME(VarnishAdmin, connect, arginfo_class_VarnishAdmin_connect, ZEND_ACC_PUBLIC) ++ PHP_ME(VarnishAdmin, auth, arginfo_class_VarnishAdmin_auth, ZEND_ACC_PUBLIC) ++ PHP_ME(VarnishAdmin, getParams, arginfo_class_VarnishAdmin_getParams, ZEND_ACC_PUBLIC) ++ PHP_ME(VarnishAdmin, setParam, arginfo_class_VarnishAdmin_setParam, ZEND_ACC_PUBLIC) ++ PHP_ME(VarnishAdmin, stop, arginfo_class_VarnishAdmin_stop, ZEND_ACC_PUBLIC) ++ PHP_ME(VarnishAdmin, start, arginfo_class_VarnishAdmin_start, ZEND_ACC_PUBLIC) ++ PHP_ME(VarnishAdmin, banUrl, arginfo_class_VarnishAdmin_banUrl, ZEND_ACC_PUBLIC) ++ PHP_ME(VarnishAdmin, ban, arginfo_class_VarnishAdmin_ban, ZEND_ACC_PUBLIC) ++ PHP_ME(VarnishAdmin, isRunning, arginfo_class_VarnishAdmin_isRunning, ZEND_ACC_PUBLIC) ++ PHP_ME(VarnishAdmin, getPanic, arginfo_class_VarnishAdmin_getPanic, ZEND_ACC_PUBLIC) ++ PHP_ME(VarnishAdmin, clearPanic, arginfo_class_VarnishAdmin_clearPanic, ZEND_ACC_PUBLIC) ++ PHP_ME(VarnishAdmin, setHost, arginfo_class_VarnishAdmin_setHost, ZEND_ACC_PUBLIC) ++ PHP_ME(VarnishAdmin, setIdent, arginfo_class_VarnishAdmin_setIdent, ZEND_ACC_PUBLIC) ++ PHP_ME(VarnishAdmin, setTimeout, arginfo_class_VarnishAdmin_setTimeout, ZEND_ACC_PUBLIC) ++ PHP_ME(VarnishAdmin, setPort, arginfo_class_VarnishAdmin_setPort, ZEND_ACC_PUBLIC) ++ PHP_ME(VarnishAdmin, setSecret, arginfo_class_VarnishAdmin_setSecret, ZEND_ACC_PUBLIC) ++ PHP_ME(VarnishAdmin, setCompat, arginfo_class_VarnishAdmin_setCompat, ZEND_ACC_PUBLIC) ++ PHP_ME(VarnishAdmin, getVclList, arginfo_class_VarnishAdmin_getVclList, ZEND_ACC_PUBLIC) ++ PHP_ME(VarnishAdmin, vclUse, arginfo_class_VarnishAdmin_vclUse, ZEND_ACC_PUBLIC) ++ PHP_ME(VarnishAdmin, disconnect, arginfo_class_VarnishAdmin_disconnect, ZEND_ACC_PUBLIC) + {NULL, NULL, NULL} + }; + /* }}} */ +@@ -97,9 +115,9 @@ + + /* {{{ VarnishStat_methods{} */ + const zend_function_entry VarnishStat_methods[] = { +- PHP_ME(VarnishStat, __construct, NULL, ZEND_ACC_PUBLIC) ++ PHP_ME(VarnishStat, __construct, arginfo_class_VarnishStat___construct, ZEND_ACC_PUBLIC) + #if defined(HAVE_VARNISHAPILIB) && HAVE_VARNISHAPILIB < 40 +- PHP_ME(VarnishStat, getSnapshot, NULL, ZEND_ACC_PUBLIC) ++ PHP_ME(VarnishStat, getSnapshot, arginfo_class_VarnishStat_getSnapshot, ZEND_ACC_PUBLIC) + #endif + {NULL, NULL, NULL} + }; +@@ -107,10 +125,10 @@ + + /* {{{ VarnishLog_methods{} */ + const zend_function_entry VarnishLog_methods[] = { +- PHP_ME(VarnishLog, __construct, NULL, ZEND_ACC_PUBLIC) ++ PHP_ME(VarnishLog, __construct, arginfo_class_VarnishLog___construct, ZEND_ACC_PUBLIC) + #if defined(HAVE_VARNISHAPILIB) && HAVE_VARNISHAPILIB < 40 +- PHP_ME(VarnishLog, getLine, NULL, ZEND_ACC_PUBLIC) +- PHP_ME(VarnishLog, getTagName, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) ++ PHP_ME(VarnishLog, getLine, arginfo_class_VarnishLog_getLine, ZEND_ACC_PUBLIC) ++ PHP_ME(VarnishLog, getTagName, arginfo_class_VarnishLog_getTagName, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) + #endif + {NULL, NULL, NULL} + }; +Index: varnish.stub.php +=================================================================== +--- /dev/null ++++ pecl/varnish/trunk/varnish.stub.php (copie de travail) +@@ -0,0 +1,59 @@ ++= 40 - VSM_Error(vsd) - #else -@@ -394,6 +395,7 @@ - zend_throw_exception_ex( - VarnishException_ce, - PHP_VARNISH_SHM_EXCEPTION TSRMLS_CC, -+ "%s", - #if HAVE_VARNISHAPILIB >= 40 - VSM_Error(vsd) - #else -- cgit