From c44642ff5eb3257a0fe7b1a17001ea5fc52393fd Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 21 Jul 2023 15:23:29 +0200 Subject: build out of sources tree --- PHPINFO | 4 +- REFLECTION | 9 ++- gnupg-php81.patch | 166 ---------------------------------------------------- php-pecl-gnupg.spec | 104 +++++++++++++++----------------- 4 files changed, 55 insertions(+), 228 deletions(-) delete mode 100644 gnupg-php81.patch diff --git a/PHPINFO b/PHPINFO index fedcd7e..662bff9 100644 --- a/PHPINFO +++ b/PHPINFO @@ -2,5 +2,5 @@ gnupg gnupg support => enabled -GPGme Version => 1.15.1 -Extension Version => 1.5.0 +GPGme Version => 1.17.0 +Extension Version => 1.5.1 diff --git a/REFLECTION b/REFLECTION index 4f97f10..e260b2d 100644 --- a/REFLECTION +++ b/REFLECTION @@ -1,4 +1,4 @@ -Extension [ extension #119 gnupg version 1.5.0 ] { +Extension [ extension #124 gnupg version 1.5.1 ] { - Constants [36] { Constant [ int GNUPG_SIG_MODE_NORMAL ] { 0 } @@ -36,7 +36,7 @@ Extension [ extension #119 gnupg version 1.5.0 ] { Constant [ int GNUPG_PK_ECDSA ] { 301 } Constant [ int GNUPG_PK_ECDH ] { 302 } Constant [ int GNUPG_PK_EDDSA ] { 303 } - Constant [ string GNUPG_GPGME_VERSION ] { 1.15.1 } + Constant [ string GNUPG_GPGME_VERSION ] { 1.17.0 } } - Functions { @@ -483,30 +483,35 @@ Extension [ extension #119 gnupg version 1.5.0 ] { - Parameters [0] { } + - Tentative return [ mixed ] } Method [ public method key ] { - Parameters [0] { } + - Tentative return [ mixed ] } Method [ public method next ] { - Parameters [0] { } + - Tentative return [ void ] } Method [ public method rewind ] { - Parameters [0] { } + - Tentative return [ void ] } Method [ public method valid ] { - Parameters [0] { } + - Tentative return [ bool ] } } } diff --git a/gnupg-php81.patch b/gnupg-php81.patch deleted file mode 100644 index 0ff0d12..0000000 --- a/gnupg-php81.patch +++ /dev/null @@ -1,166 +0,0 @@ -From 0e35e0bbf81cdbb5346fcdc0a52e022b55075e58 Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Thu, 9 Sep 2021 11:59:22 +0200 -Subject: [PATCH 1/3] Fix iterator prototypes for PHP 8.1 - ---- - gnupg_keylistiterator.c | 36 +++++++++++++++++++++++++++++++----- - 1 file changed, 31 insertions(+), 5 deletions(-) - -diff --git a/gnupg_keylistiterator.c b/gnupg_keylistiterator.c -index 215aaa0..7390edd 100644 ---- a/gnupg_keylistiterator.c -+++ b/gnupg_keylistiterator.c -@@ -90,14 +90,40 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_gnupg_void_iterator_method, 0, 0, 0) - ZEND_END_ARG_INFO() - /* }}} */ - -+#if PHP_VERSION_ID < 80100 -+ -+#define arginfo_gnupg_current arginfo_gnupg_void_iterator_method -+#define arginfo_gnupg_key arginfo_gnupg_void_iterator_method -+#define arginfo_gnupg_valid arginfo_gnupg_void_iterator_method -+#define arginfo_gnupg_next arginfo_gnupg_void_iterator_method -+#define arginfo_gnupg_rewind arginfo_gnupg_void_iterator_method -+ -+#else -+ -+ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_gnupg_current, 0, 0, IS_MIXED, 0) -+ZEND_END_ARG_INFO() -+ -+#define arginfo_gnupg_key arginfo_gnupg_current -+ -+ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_gnupg_valid, 0, 0, _IS_BOOL, 0) -+ZEND_END_ARG_INFO() -+ -+ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_gnupg_next, 0, 0, IS_VOID, 0) -+ZEND_END_ARG_INFO() -+ -+#define arginfo_gnupg_rewind arginfo_gnupg_next -+ -+#endif -+ -+ - /* {{{ method list gnupg_keylistiterator */ - static zend_function_entry gnupg_keylistiterator_methods[] = { - PHP_ME(gnupg_keylistiterator, __construct, arginfo_gnupg_void_iterator_method, ZEND_ACC_PUBLIC) -- PHP_ME(gnupg_keylistiterator, current, arginfo_gnupg_void_iterator_method, ZEND_ACC_PUBLIC) -- PHP_ME(gnupg_keylistiterator, key, arginfo_gnupg_void_iterator_method, ZEND_ACC_PUBLIC) -- PHP_ME(gnupg_keylistiterator, next, arginfo_gnupg_void_iterator_method, ZEND_ACC_PUBLIC) -- PHP_ME(gnupg_keylistiterator, rewind, arginfo_gnupg_void_iterator_method, ZEND_ACC_PUBLIC) -- PHP_ME(gnupg_keylistiterator, valid, arginfo_gnupg_void_iterator_method, ZEND_ACC_PUBLIC) -+ PHP_ME(gnupg_keylistiterator, current, arginfo_gnupg_current, ZEND_ACC_PUBLIC) -+ PHP_ME(gnupg_keylistiterator, key, arginfo_gnupg_key, ZEND_ACC_PUBLIC) -+ PHP_ME(gnupg_keylistiterator, next, arginfo_gnupg_next, ZEND_ACC_PUBLIC) -+ PHP_ME(gnupg_keylistiterator, rewind, arginfo_gnupg_rewind, ZEND_ACC_PUBLIC) -+ PHP_ME(gnupg_keylistiterator, valid, arginfo_gnupg_valid, ZEND_ACC_PUBLIC) - PHPC_FE_END - }; - /* }}} */ --- -2.31.1 - -From 512acab50beb1b375ef5621b27e1466efb010e58 Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Thu, 9 Sep 2021 12:46:48 +0200 -Subject: [PATCH 2/3] Simplify previous - ---- - gnupg_keylistiterator.c | 15 ++++----------- - 1 file changed, 4 insertions(+), 11 deletions(-) - -diff --git a/gnupg_keylistiterator.c b/gnupg_keylistiterator.c -index 7390edd..4d3c074 100644 ---- a/gnupg_keylistiterator.c -+++ b/gnupg_keylistiterator.c -@@ -90,15 +90,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_gnupg_void_iterator_method, 0, 0, 0) - ZEND_END_ARG_INFO() - /* }}} */ - --#if PHP_VERSION_ID < 80100 -- --#define arginfo_gnupg_current arginfo_gnupg_void_iterator_method --#define arginfo_gnupg_key arginfo_gnupg_void_iterator_method --#define arginfo_gnupg_valid arginfo_gnupg_void_iterator_method --#define arginfo_gnupg_next arginfo_gnupg_void_iterator_method --#define arginfo_gnupg_rewind arginfo_gnupg_void_iterator_method -- --#else -+#ifndef ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX -+#define ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(name, return_reference, required_num_args, type, allow_null) \ -+ ZEND_BEGIN_ARG_INFO_EX(name, 0, return_reference, required_num_args) -+#endif - - ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_gnupg_current, 0, 0, IS_MIXED, 0) - ZEND_END_ARG_INFO() -@@ -113,8 +108,6 @@ ZEND_END_ARG_INFO() - - #define arginfo_gnupg_rewind arginfo_gnupg_next - --#endif -- - - /* {{{ method list gnupg_keylistiterator */ - static zend_function_entry gnupg_keylistiterator_methods[] = { --- -2.31.1 - -From 6ebd34017e920c6e25878ba43d77d08c426f804e Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Thu, 9 Sep 2021 13:36:44 +0200 -Subject: [PATCH 3/3] use ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX - from phpc - ---- - gnupg_keylistiterator.c | 5 ----- - 1 file changed, 5 deletions(-) - -diff --git a/gnupg_keylistiterator.c b/gnupg_keylistiterator.c -index 4d3c074..9b285ee 100644 ---- a/gnupg_keylistiterator.c -+++ b/gnupg_keylistiterator.c -@@ -90,11 +90,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_gnupg_void_iterator_method, 0, 0, 0) - ZEND_END_ARG_INFO() - /* }}} */ - --#ifndef ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX --#define ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(name, return_reference, required_num_args, type, allow_null) \ -- ZEND_BEGIN_ARG_INFO_EX(name, 0, return_reference, required_num_args) --#endif -- - ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_gnupg_current, 0, 0, IS_MIXED, 0) - ZEND_END_ARG_INFO() - --- -2.31.1 - -From e9e2769c852ac5d6755245387755c589379a1e1c Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Thu, 9 Sep 2021 13:34:59 +0200 -Subject: [PATCH] define ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX for - php < 8.1 - ---- - phpc.h | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/phpc.h b/phpc.h -index 4b55747..70fb317 100644 ---- a/phpc/phpc.h -+++ b/phpc/phpc.h -@@ -51,6 +51,12 @@ - memcpy(&PHPC_OBJ_GET_HANDLER_VAR_NAME(_name), \ - zend_get_std_object_handlers(), sizeof(zend_object_handlers)) - -+/* for arginfo */ -+#ifndef ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX -+#define ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(name, return_reference, required_num_args, type, allow_null) \ -+ ZEND_BEGIN_ARG_INFO_EX(name, 0, return_reference, required_num_args) -+#endif -+ - /* ZEND_ACC_CTOR and ZEND_ACC_DTOR is removed in 7.4 */ - #ifndef ZEND_ACC_CTOR - #define ZEND_ACC_CTOR 0 --- -2.31.1 - diff --git a/php-pecl-gnupg.spec b/php-pecl-gnupg.spec index 8db5d5e..0d5ade8 100644 --- a/php-pecl-gnupg.spec +++ b/php-pecl-gnupg.spec @@ -1,38 +1,42 @@ # spec file for php-pecl-gnupg # -# Copyright (c) 2012-2021 Remi Collet -# License: CC-BY-SA +# Copyright (c) 2012-2023 Remi Collet +# License: CC-BY-SA-4.0 # 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-gnupg -%endif -%global with_tests 0%{!?_without_tests:1} +%{?scl:%scl_package php-pecl-gnupg} + +%bcond_without tests -%global pecl_name gnupg -%global with_zts 0%{!?_without_zts:%{?__ztsphp:1}} +%global pecl_name gnupg +%global with_zts 0%{!?_without_zts:%{?__ztsphp:1}} %if "%{php_version}" < "5.6" -%global ini_name %{pecl_name}.ini +%global ini_name %{pecl_name}.ini %else -%global ini_name 40-%{pecl_name}.ini +%global ini_name 40-%{pecl_name}.ini %endif -%global upstream_version 1.5.0 +%global upstream_version 1.5.1 #global upstream_prever RC2 +%global sources %{pecl_name}-%{upstream_version}%{?upstream_prever} +%global _configure ../%{sources}/configure + +# For PHP < 5.6 and EPEL-9 +%{!?__phpize: %global __phpize %{_bindir}/phpize} +%{!?__ztsphpize: %global __ztsphpize %{_bindir}/zts-phpize} +%{!?__phpconfig: %global __phpconfig %{_bindir}/php-config} +%{!?__ztsphpconfig:%global __ztsphpconfig %{_bindir}/zts-php-config} Summary: Wrapper around the gpgme library -Name: %{?sub_prefix}php-pecl-gnupg +Name: %{?scl_prefix}php-pecl-gnupg Version: %{upstream_version}%{?upstream_prever:~%{upstream_prever}} -Release: 3%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} +Release: 2%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} -License: BSD +License: BSD-2-Clause URL: https://pecl.php.net/package/gnupg Source0: https://pecl.php.net/get/%{pecl_name}-%{upstream_version}%{?upstream_prever}.tgz -Patch0: %{pecl_name}-php81.patch - BuildRequires: make BuildRequires: %{?dtsprefix}gcc BuildRequires: %{?scl_prefix}php-devel @@ -52,32 +56,11 @@ Requires: gnupg1 %else Requires: gnupg %endif -%{?_sclreq:Requires: %{?scl_prefix}runtime%{?_sclreq}%{?_isa}} 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.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 -%if "%{php_version}" > "8.1" -Obsoletes: php81-pecl-%{pecl_name} <= %{version} -%endif -%endif %description @@ -102,10 +85,7 @@ cat >%{ini_name} << 'EOF' extension=%{pecl_name}.so EOF -mv %{pecl_name}-%{upstream_version}%{?upstream_prever} NTS -cd NTS -%patch0 -p1 -b .php81 - +cd %{sources} # Check extension version extver=$(sed -n '/#define PHP_GNUPG_VERSION/{s/.* "//;s/".*$//;p}' php_gnupg.h) if test "x${extver}" != "x%{upstream_version}%{?upstream_prever}"; then @@ -114,9 +94,10 @@ if test "x${extver}" != "x%{upstream_version}%{?upstream_prever}"; then fi cd .. +mkdir NTS %if %{with_zts} # Build ZTS extension if ZTS devel available (fedora >= 17) -cp -r NTS ZTS +mkdir ZTS %endif @@ -133,23 +114,25 @@ gpg --version %endif peclbuild() { -%{_bindir}/${1}ize %configure \ %if 0%{?rhel} == 7 --with-gpg=$GPG1 \ %endif --with-libdir=%{_lib} \ - --with-php-config=%{_bindir}/${1}-config + --with-php-config=${1} make %{?_smp_mflags} } -cd NTS -peclbuild php +cd %{sources} +%{__phpize} + +cd ../NTS +peclbuild %{__phpconfig} %if %{with_zts} cd ../ZTS -peclbuild zts-php +peclbuild %{__ztsphpconfig} %endif @@ -171,7 +154,7 @@ install -D -m 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name} # Documentation 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 @@ -196,22 +179,21 @@ fi %check +cd %{sources} sed -e '/GnuPG v1/d' \ - -i ?TS/tests/gnupg_*_export.phpt + -i tests/gnupg_*_export.phpt unset GPG_AGENT_INFO -cd NTS : Check if build NTS extension can be loaded %{__php} -n -q \ -d extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \ - --modules | grep %{pecl_name} + --modules | grep '^%{pecl_name}$' -%if %{with_tests} +%if %{with tests} : Run upstream test suite for NTS extension -TEST_PHP_EXECUTABLE=%{_bindir}/php \ +TEST_PHP_EXECUTABLE=%{__php} \ REPORT_EXIT_STATUS=1 \ -NO_INTERACTION=1 \ %{__php} -n run-tests.php \ -n -q \ -d extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \ @@ -219,16 +201,15 @@ NO_INTERACTION=1 \ %endif %if %{with_zts} -cd ../ZTS : Check if build ZTS extension can be loaded %{__ztsphp} -n -q \ -d extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \ - --modules | grep %{pecl_name} + --modules | grep '^%{pecl_name}$' %endif %files -%{?_licensedir:%license NTS/LICENSE} +%{?_licensedir:%license %{sources}/LICENSE} %doc %{pecl_docdir}/%{pecl_name} %{pecl_xmldir}/%{name}.xml @@ -242,6 +223,13 @@ cd ../ZTS %changelog +* Fri Jul 21 2023 Remi Collet - 1.5.1-2 +- build out of sources tree + +* Sat Jan 1 2022 Remi Collet - 1.5.1-1 +- update to 1.5.1 +- drop patch merged upstream + * Thu Sep 9 2021 Remi Collet - 1.5.0-3 - improve patch for PHP 8.1 from https://github.com/php-gnupg/php-gnupg/pull/35 -- cgit