From 61b0334db3c06de21f355bd1eb4177d61b80e7b7 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 27 Jul 2023 13:49:19 +0200 Subject: update to 3.1.5 build out of sources tree --- PHPINFO | 2 +- REFLECTION | 2 +- mailparse-php83.patch | 106 ------------------------------------------------ php-pecl-mailparse.spec | 57 +++++++++++++------------- 4 files changed, 31 insertions(+), 136 deletions(-) delete mode 100644 mailparse-php83.patch diff --git a/PHPINFO b/PHPINFO index fd53c88..a9a2df6 100644 --- a/PHPINFO +++ b/PHPINFO @@ -2,7 +2,7 @@ mailparse mailparse support => enabled -Extension Version => 3.1.4 +Extension Version => 3.1.5 Directive => Local Value => Master Value mailparse.def_charset => us-ascii => us-ascii diff --git a/REFLECTION b/REFLECTION index 2e37bd0..1633ecb 100644 --- a/REFLECTION +++ b/REFLECTION @@ -1,4 +1,4 @@ -Extension [ extension #84 mailparse version 3.1.4 ] { +Extension [ extension #83 mailparse version 3.1.5 ] { - Dependencies { Dependency [ mbstring (Required) ] diff --git a/mailparse-php83.patch b/mailparse-php83.patch deleted file mode 100644 index 06c8443..0000000 --- a/mailparse-php83.patch +++ /dev/null @@ -1,106 +0,0 @@ -From a0d99d637281753f62a28842aad716352dc0e5a3 Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Tue, 30 May 2023 15:22:05 +0200 -Subject: [PATCH] drop usage of removed mbfl APIs in PHP 8.3 - ---- - mailparse.c | 19 ++++++++++--------- - package.xml | 2 +- - php_mailparse_mime.c | 7 +++++-- - 3 files changed, 16 insertions(+), 12 deletions(-) - -diff --git a/mailparse.c b/mailparse.c -index dde0f18..315bfee 100644 ---- a/mailparse.c -+++ b/mailparse.c -@@ -942,17 +942,15 @@ PHP_FUNCTION(mailparse_determine_best_xfer_encoding) - else if (++linelen > 200) - longline = 1; - } -- if (longline) -+ if (longline) { - bestenc = mbfl_no_encoding_qprint; -+ } - php_stream_rewind(stream); - -- name = (char *)mbfl_no2preferred_mime_name(bestenc); -- if (name) -- { -+ name = mbfl_encoding_preferred_mime_name(mbfl_no2encoding(bestenc)); -+ if (name) { - RETVAL_STRING(name); -- } -- else -- { -+ } else { - RETVAL_FALSE; - } - } -@@ -980,6 +978,7 @@ PHP_FUNCTION(mailparse_stream_encode) - char *buf; - size_t len; - size_t bufsize = 2048; -+ const mbfl_encoding *encoding; - enum mbfl_no_encoding enc; - mbfl_convert_filter *conv = NULL; - -@@ -997,8 +996,10 @@ PHP_FUNCTION(mailparse_stream_encode) - php_stream_from_zval(srcstream, srcfile); - php_stream_from_zval(deststream, destfile); - -- enc = mbfl_name2no_encoding(ZSTR_VAL(encod)); -- if (enc == mbfl_no_encoding_invalid) { -+ encoding = mbfl_name2encoding(ZSTR_VAL(encod)); -+ if (encoding) { -+ enc = encoding->no_encoding; -+ } else { - zend_error(E_WARNING, "%s(): unknown encoding \"%s\"", - get_active_function_name(), - ZSTR_VAL(encod) -diff --git a/php_mailparse_mime.c b/php_mailparse_mime.c -index fdf5862..49934f1 100644 ---- a/php_mailparse_mime.c -+++ b/php_mailparse_mime.c -@@ -913,11 +913,14 @@ static int filter_into_work_buffer(int c, void *dat) - - PHP_MAILPARSE_API void php_mimepart_decoder_prepare(php_mimepart *part, int do_decode, php_mimepart_extract_func_t decoder, void *ptr) - { -+ const mbfl_encoding *encoding; - enum mbfl_no_encoding from = mbfl_no_encoding_8bit; - - if (do_decode && part->content_transfer_encoding) { -- from = mbfl_name2no_encoding(part->content_transfer_encoding); -- if (from == mbfl_no_encoding_invalid) { -+ encoding = mbfl_name2encoding(part->content_transfer_encoding); -+ if (encoding) { -+ from = encoding->no_encoding; -+ } else { - if (strcasecmp("binary", part->content_transfer_encoding) != 0) { - zend_error(E_WARNING, "%s(): mbstring doesn't know how to decode %s transfer encoding!", - get_active_function_name(), -From 59e040beacaa93626343bd440c4172bbc4aaef03 Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Tue, 30 May 2023 15:39:31 +0200 -Subject: [PATCH] fix regression for PHP < 8.1 - ---- - mailparse.c | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/mailparse.c b/mailparse.c -index 315bfee..0f177ce 100644 ---- a/mailparse.c -+++ b/mailparse.c -@@ -947,7 +947,11 @@ PHP_FUNCTION(mailparse_determine_best_xfer_encoding) - } - php_stream_rewind(stream); - -- name = mbfl_encoding_preferred_mime_name(mbfl_no2encoding(bestenc)); -+#if PHP_VERSION_ID < 80100 -+ name = (char *)mbfl_no2preferred_mime_name(bestenc); -+#else -+ name = (char *)mbfl_encoding_preferred_mime_name(mbfl_no2encoding(bestenc)); -+#endif - if (name) { - RETVAL_STRING(name); - } else { diff --git a/php-pecl-mailparse.spec b/php-pecl-mailparse.spec index ad6d566..25eb483 100644 --- a/php-pecl-mailparse.spec +++ b/php-pecl-mailparse.spec @@ -19,19 +19,19 @@ %bcond_without tests -%global pecl_name mailparse -%global with_zts 0%{!?_without_zts:%{?__ztsphp:1}} -%global ini_name 40-%{pecl_name}.ini +%global pecl_name mailparse +%global with_zts 0%{!?_without_zts:%{?__ztsphp:1}} +%global ini_name 40-%{pecl_name}.ini +%global sources %{pecl_name}-%{version} +%global _configure ../%{sources}/configure Summary: PHP PECL package for parsing and working with email messages Name: %{?scl_prefix}php-pecl-mailparse -Version: 3.1.4 -Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Version: 3.1.5 +Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} License: PHP-3.01 URL: https://pecl.php.net/package/mailparse -Source0: https://pecl.php.net/get/%{pecl_name}-%{version}.tgz - -Patch0: %{pecl_name}-php83.patch +Source0: https://pecl.php.net/get/%{sources}.tgz BuildRequires: make BuildRequires: %{?dtsprefix}gcc @@ -47,7 +47,6 @@ BuildRequires: autoconf, automake, libtool Requires: %{?scl_prefix}php-mbstring%{?_isa} Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api} Requires: %{?scl_prefix}php(api) = %{php_core_api} -%{?_sclreq:Requires: %{?scl_prefix}runtime%{?_sclreq}%{?_isa}} Provides: %{?scl_prefix}php-%{pecl_name} = %{version} Provides: %{?scl_prefix}php-%{pecl_name}%{?_isa} = %{version} @@ -65,16 +64,12 @@ Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSIO %prep %setup -q -c -mv %{pecl_name}-%{version} NTS - # Don't install/register tests sed -e 's/role="test"/role="src"/' \ %{?_licensedir:-e '/LICENSE/s/role="doc"/role="src"/' } \ -i package.xml -cd NTS -%patch -P0 -p1 -b.php83 - +cd %{sources} extver=$(sed -n '/#define PHP_MAILPARSE_VERSION/{s/.* "//;s/".*$//;p}' php_mailparse.h) if test "x${extver}" != "x%{version}"; then : Error: Upstream version is ${extver}, expecting %{version}. @@ -90,23 +85,25 @@ extension = mailparse.so ;mailparse.def_charset = us-ascii EOF +mkdir NTS %if %{with_zts} -cp -pr NTS ZTS +mkdir ZTS %endif %build %{?dtsenable} -cd NTS -%{_bindir}/phpize -%configure --with-php-config=%{_bindir}/php-config +cd %{sources} +%{__phpize} + +cd ../NTS +%configure --with-php-config=%{__phpconfig} make %{?_smp_mflags} %if %{with_zts} cd ../ZTS -%{_bindir}/zts-phpize -%configure --with-php-config=%{_bindir}/zts-php-config +%configure --with-php-config=%{__ztsphpconfig} make %{?_smp_mflags} %endif @@ -129,11 +126,13 @@ install -Dpm 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml # 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 %check +cd %{sources} + : Minimal load test for NTS extension %{__php} --no-php-ini \ --define extension=mbstring.so \ @@ -142,11 +141,10 @@ done %if %{with tests} : Upstream test suite for NTS extension -cd NTS TEST_PHP_EXECUTABLE=%{__php} \ -%{__php} run-tests.php -n -q \ +%{__php} -n run-tests.php -n -q \ -d extension=mbstring.so \ - -d extension=$PWD/modules/%{pecl_name}.so \ + -d extension=$PWD/../NTS/modules/%{pecl_name}.so \ --show-diff %endif @@ -159,11 +157,10 @@ TEST_PHP_EXECUTABLE=%{__php} \ %if %{with tests} : Upstream test suite for ZTS extension -cd ../ZTS TEST_PHP_EXECUTABLE=%{__ztsphp} \ -php run-tests.php -n -q \ +%{__ztsphp} -n run-tests.php -n -q \ -d extension=mbstring.so \ - -d extension=$PWD/modules/%{pecl_name}.so \ + -d extension=$PWD/../ZTS/modules/%{pecl_name}.so \ --show-diff %endif %endif @@ -190,7 +187,7 @@ fi %files -%{?_licensedir:%license NTS/LICENSE} +%{?_licensedir:%license %{sources}/LICENSE} %doc %{pecl_docdir}/%{pecl_name} %{pecl_xmldir}/%{name}.xml @@ -204,6 +201,10 @@ fi %changelog +* Thu Jul 27 2023 Remi Collet - 3.1.5-1 +- update to 3.1.5 +- build out of sources tree + * Tue Jun 6 2023 Remi Collet - 3.1.4-2 - add upstream patches for PHP 8.3 -- cgit