diff options
author | Remi Collet <remi@remirepo.net> | 2020-12-03 11:06:39 +0100 |
---|---|---|
committer | Remi Collet <remi@remirepo.net> | 2020-12-03 11:06:39 +0100 |
commit | fce7dfc48bbf810d94e898419a2a997df4cba888 (patch) | |
tree | 82b7efe6c7bb3a1d9e78134efcfc20179d87ecc7 | |
parent | 1d3f1d05ce18099f3984ebc0a4ea9e1fa8a1755f (diff) |
add upstream patch for PHP 8
-rw-r--r-- | php-pecl-varnish.spec | 50 | ||||
-rw-r--r-- | varnish-php8.patch | 274 | ||||
-rw-r--r-- | varnish-upstream.patch | 28 |
3 files changed, 294 insertions, 58 deletions
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 <remi@remirepo.net> - 1.2.4-5 +- add upstream patch for PHP 8 + * Tue Sep 03 2019 Remi Collet <remi@remirepo.net> - 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 @@ ++<?php ++ ++class VarnishAdmin { ++ public function __construct(array $opt = []); ++ ++ public function connect(): bool; ++ ++ public function auth(): bool; ++ ++ public function getParams(): array; ++ ++ public function setParam(string $name, string $value): int; ++ ++ public function stop(): int; ++ ++ public function start(): int; ++ ++ public function banUrl(string $regex): int; ++ ++ public function ban(string $regex): int; ++ ++ public function isRunning(): bool; ++ ++ public function getPanic(): string; ++ ++ public function clearPanic(): int; ++ ++ public function setHost(string $host): void; ++ ++ public function setIdent(string $ident): void; ++ ++ public function setSecret(string $secret): void; ++ ++ public function setTimeout(int $timeout): void; ++ ++ public function setPort(int $port): void; ++ ++ public function setCompat(int $compat): void; ++ ++ public function getVclList(): array; ++ ++ public function vclUse(string $name): bool; ++ ++ public function disconnect(): bool; ++} ++ ++class VarnishStat { ++ public function __construct(array $opt = []); ++ ++ public function getSnapshot(): array; ++} ++ ++class VarnishLog { ++ public function __construct(array $opt = []); ++ ++ public function getLine(): array; ++ ++ public function getTagName(int $ind): string; ++} + +Index: varnish_arginfo.h +=================================================================== +--- /dev/null ++++ pecl/varnish/trunk/varnish_arginfo.h (copie de travail) +@@ -0,0 +1,81 @@ ++/* This is a generated file, edit the .stub.php file instead. ++ * Stub hash: 8f85af0f0ca3c73efcc24ed046662a4df80bf74f */ ++ ++ZEND_BEGIN_ARG_INFO_EX(arginfo_class_VarnishAdmin___construct, 0, 0, 0) ++ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, opt, IS_ARRAY, 0, "[]") ++ZEND_END_ARG_INFO() ++ ++ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_VarnishAdmin_connect, 0, 0, _IS_BOOL, 0) ++ZEND_END_ARG_INFO() ++ ++#define arginfo_class_VarnishAdmin_auth arginfo_class_VarnishAdmin_connect ++ ++ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_VarnishAdmin_getParams, 0, 0, IS_ARRAY, 0) ++ZEND_END_ARG_INFO() ++ ++ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_VarnishAdmin_setParam, 0, 2, IS_LONG, 0) ++ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) ++ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0) ++ZEND_END_ARG_INFO() ++ ++ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_VarnishAdmin_stop, 0, 0, IS_LONG, 0) ++ZEND_END_ARG_INFO() ++ ++#define arginfo_class_VarnishAdmin_start arginfo_class_VarnishAdmin_stop ++ ++ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_VarnishAdmin_banUrl, 0, 1, IS_LONG, 0) ++ ZEND_ARG_TYPE_INFO(0, regex, IS_STRING, 0) ++ZEND_END_ARG_INFO() ++ ++#define arginfo_class_VarnishAdmin_ban arginfo_class_VarnishAdmin_banUrl ++ ++#define arginfo_class_VarnishAdmin_isRunning arginfo_class_VarnishAdmin_connect ++ ++ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_VarnishAdmin_getPanic, 0, 0, IS_STRING, 0) ++ZEND_END_ARG_INFO() ++ ++#define arginfo_class_VarnishAdmin_clearPanic arginfo_class_VarnishAdmin_stop ++ ++ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_VarnishAdmin_setHost, 0, 1, IS_VOID, 0) ++ ZEND_ARG_TYPE_INFO(0, host, IS_STRING, 0) ++ZEND_END_ARG_INFO() ++ ++ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_VarnishAdmin_setIdent, 0, 1, IS_VOID, 0) ++ ZEND_ARG_TYPE_INFO(0, ident, IS_STRING, 0) ++ZEND_END_ARG_INFO() ++ ++ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_VarnishAdmin_setSecret, 0, 1, IS_VOID, 0) ++ ZEND_ARG_TYPE_INFO(0, secret, IS_STRING, 0) ++ZEND_END_ARG_INFO() ++ ++ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_VarnishAdmin_setTimeout, 0, 1, IS_VOID, 0) ++ ZEND_ARG_TYPE_INFO(0, timeout, IS_LONG, 0) ++ZEND_END_ARG_INFO() ++ ++ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_VarnishAdmin_setPort, 0, 1, IS_VOID, 0) ++ ZEND_ARG_TYPE_INFO(0, port, IS_LONG, 0) ++ZEND_END_ARG_INFO() ++ ++ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_VarnishAdmin_setCompat, 0, 1, IS_VOID, 0) ++ ZEND_ARG_TYPE_INFO(0, compat, IS_LONG, 0) ++ZEND_END_ARG_INFO() ++ ++#define arginfo_class_VarnishAdmin_getVclList arginfo_class_VarnishAdmin_getParams ++ ++ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_VarnishAdmin_vclUse, 0, 1, _IS_BOOL, 0) ++ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) ++ZEND_END_ARG_INFO() ++ ++#define arginfo_class_VarnishAdmin_disconnect arginfo_class_VarnishAdmin_connect ++ ++#define arginfo_class_VarnishStat___construct arginfo_class_VarnishAdmin___construct ++ ++#define arginfo_class_VarnishStat_getSnapshot arginfo_class_VarnishAdmin_getParams ++ ++#define arginfo_class_VarnishLog___construct arginfo_class_VarnishAdmin___construct ++ ++#define arginfo_class_VarnishLog_getLine arginfo_class_VarnishAdmin_getParams ++ ++ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_VarnishLog_getTagName, 0, 1, IS_STRING, 0) ++ ZEND_ARG_TYPE_INFO(0, ind, IS_LONG, 0) ++ZEND_END_ARG_INFO() diff --git a/varnish-upstream.patch b/varnish-upstream.patch deleted file mode 100644 index a1fd02a..0000000 --- a/varnish-upstream.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- pecl/varnish/trunk/exception.c 2018/06/27 11:47:15 345221 -+++ pecl/varnish/trunk/exception.c 2018/06/27 13:34:24 345222 -@@ -86,6 +86,7 @@ - zend_throw_exception_ex( - VarnishException_ce, - PHP_VARNISH_UNIMPL_EXCEPTION TSRMLS_CC, -+ "%s", - (NULL != msg) ? msg : "The functionality you're trying to use is not available on windows" - ); - } ---- pecl/varnish/trunk/varnish_lib.c 2018/06/27 11:47:15 345221 -+++ pecl/varnish/trunk/varnish_lib.c 2018/06/27 13:34:24 345222 -@@ -373,6 +373,7 @@ - zend_throw_exception_ex( - VarnishException_ce, - PHP_VARNISH_SHM_EXCEPTION TSRMLS_CC, -+ "%s", - #if HAVE_VARNISHAPILIB >= 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 |