From 5fc4d7be6746769330e8461eebfcad57cad05285 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 2 Aug 2021 16:43:15 +0200 Subject: update to 1.1.2 drop all patches merged upstream --- PHPINFO | 2 +- REFLECTION | 2 +- php-xz.spec | 24 ++++------ pr1.patch | 75 ----------------------------- pr2.patch | 82 ------------------------------- pr3.patch | 157 ------------------------------------------------------------ 6 files changed, 11 insertions(+), 331 deletions(-) delete mode 100644 pr1.patch delete mode 100644 pr2.patch delete mode 100644 pr3.patch diff --git a/PHPINFO b/PHPINFO index 5149fd8..b1d033f 100644 --- a/PHPINFO +++ b/PHPINFO @@ -2,7 +2,7 @@ xz xz support => enabled -xz extension version => 1.1.1 +xz extension version => 1.1.2 liblzma version => 5.2.5 Directive => Local Value => Master Value diff --git a/REFLECTION b/REFLECTION index dde87e2..a689ff4 100644 --- a/REFLECTION +++ b/REFLECTION @@ -1,4 +1,4 @@ -Extension [ extension #108 xz version 1.1.1 ] { +Extension [ extension #108 xz version 1.1.2 ] { - INI { Entry [ xz.compression_level ] diff --git a/php-xz.spec b/php-xz.spec index 68fa9fd..5bf98f2 100644 --- a/php-xz.spec +++ b/php-xz.spec @@ -16,7 +16,7 @@ %global pkg_name %{name} %endif -%global gh_commit 84e8742a9a7cdb985190a02f270298efcf264c21 +%global gh_commit be72e636dd7dd8a220cb9b54f2970477dad878a0 %global gh_short %(c=%{gh_commit}; echo ${c:0:7}) %global gh_owner codemasher %global gh_project php-ext-xz @@ -26,22 +26,15 @@ Summary: XZ (LZMA2) compression/decompression Name: %{?scl_prefix}php-%{pecl_name} -Version: 1.1.1 +Version: 1.1.2 Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} License: PHP URL: https://github.com/%{gh_owner}/%{gh_project} Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}-%{gh_short}.tar.gz -# library check -Patch0: pr1.patch -# extension version -Patch1: pr2.patch -# arginfo -Patch2: pr3.patch - BuildRequires: make BuildRequires: %{?dtsprefix}gcc -BuildRequires: %{?scl_prefix}php-devel +BuildRequires: %{?scl_prefix}php-devel >= 7.0 BuildRequires: pkgconfig(liblzma) Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api} @@ -76,9 +69,6 @@ mv %{gh_project}-%{gh_commit} NTS cd NTS mv LICENSE.txt LICENSE -%patch0 -p1 -b .pr1 -%patch1 -p1 -b .pr2 -%patch2 -p1 -b .pr3 # Sanity check, really often broken extver=$(sed -n '/#define PHP_XZ_VERSION/{s/.* "//;s/".*$//;p}' php_xz.h) @@ -152,7 +142,7 @@ cd NTS TEST_PHP_EXECUTABLE=%{__php} \ TEST_PHP_ARGS="-n -d extension=%{buildroot}%{php_extdir}/%{pecl_name}.so" \ REPORT_EXIT_STATUS=1 \ -%{__php} -n run-tests.php -q --offline --show-diff +%{__php} -n run-tests.php -q -x --offline --show-diff %if %{with_zts} cd ../ZTS @@ -165,7 +155,7 @@ cd ../ZTS TEST_PHP_EXECUTABLE=%{__ztsphp} \ TEST_PHP_ARGS="-n -d extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so" \ REPORT_EXIT_STATUS=1 \ -%{__ztsphp} -n run-tests.php -q --offline --show-diff +%{__ztsphp} -n run-tests.php -q -x --offline --show-diff %endif @@ -184,6 +174,10 @@ REPORT_EXIT_STATUS=1 \ %changelog +* Mon Aug 2 2021 Remi Collet - 1.1.2-1 +- update to 1.1.2 +- drop all patches merged upstream + * Fri Jul 9 2021 Remi Collet - 1.1.1-1 - new package, version 1.1.1 - open https://github.com/codemasher/php-ext-xz/pull/1 library check diff --git a/pr1.patch b/pr1.patch deleted file mode 100644 index b574d78..0000000 --- a/pr1.patch +++ /dev/null @@ -1,75 +0,0 @@ -From be78be9c43fc87bc2bc936f60b3091e72cf5492a Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Fri, 9 Jul 2021 15:28:51 +0200 -Subject: [PATCH 1/2] fix lib test - ---- - config.m4 | 5 +---- - 1 file changed, 1 insertion(+), 4 deletions(-) - -diff --git a/config.m4 b/config.m4 -index 02dd4b7..ec0c30f 100644 ---- a/config.m4 -+++ b/config.m4 -@@ -12,12 +12,9 @@ if test "$PHP_XZ" != "no"; then - - PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL, - [ -- PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $XZ_DIR/lib, XZ_SHARED_LIBADD) -- AC_DEFINE(HAVE_XZLIB,1,[ ]) -+ PHP_ADD_LIBRARY($LIBNAME, 1, XZ_SHARED_LIBADD) - ],[ - AC_MSG_ERROR([wrong xz lib version or lib not found]) -- ],[ -- -L$XZ_DIR/lib -lm - ]) - PHP_SUBST(XZ_SHARED_LIBADD) - - -From 3ef5b4ade5bb94358fba1bcba9bc8538749d3479 Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Fri, 9 Jul 2021 15:50:54 +0200 -Subject: [PATCH 2/2] rely on pkg-config - ---- - config.m4 | 27 +++++++++++++++++++++------ - 1 file changed, 21 insertions(+), 6 deletions(-) - -diff --git a/config.m4 b/config.m4 -index ec0c30f..e6c03ef 100644 ---- a/config.m4 -+++ b/config.m4 -@@ -10,12 +10,27 @@ if test "$PHP_XZ" != "no"; then - LIBNAME=lzma # you may want to change this - LIBSYMBOL=lzma_stream_encoder # you most likely want to change this - -- PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL, -- [ -- PHP_ADD_LIBRARY($LIBNAME, 1, XZ_SHARED_LIBADD) -- ],[ -- AC_MSG_ERROR([wrong xz lib version or lib not found]) -- ]) -+ AC_PATH_PROG(PKG_CONFIG, pkg-config, no) -+ -+ AC_MSG_CHECKING(for liblzma) -+ if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists liblzma; then -+ LIBLZMA_INCLINE=`$PKG_CONFIG liblzma --cflags` -+ LIBLZMA_LIBLINE=`$PKG_CONFIG liblzma --libs` -+ LIBLZMA_VERSION=`$PKG_CONFIG liblzma --modversion` -+ AC_MSG_RESULT(from pkg-config: version $LIBLZMA_VERSION) -+ PHP_EVAL_LIBLINE($LIBLZMA_LIBLINE, XZ_SHARED_LIBADD) -+ PHP_EVAL_INCLINE($LIBLZMA_INCLINE) -+ else -+ AC_MSG_WARN([not found using pkg-config, fallback to system directory]) -+ -+ PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL, -+ [ -+ PHP_ADD_LIBRARY($LIBNAME, 1, XZ_SHARED_LIBADD) -+ ],[ -+ AC_MSG_ERROR([wrong xz lib version or lib not found]) -+ ]) -+ fi -+ - PHP_SUBST(XZ_SHARED_LIBADD) - - PHP_NEW_EXTENSION(xz, xz.c xz_fopen_wrapper.c utils.c, $ext_shared, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1) diff --git a/pr2.patch b/pr2.patch deleted file mode 100644 index 394a42d..0000000 --- a/pr2.patch +++ /dev/null @@ -1,82 +0,0 @@ -From b53da53d60c479baa2e33859bdb03cad0ea5b540 Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Fri, 9 Jul 2021 16:10:52 +0200 -Subject: [PATCH 1/2] use extension version instead of PHP version - ---- - php_xz.h | 2 ++ - xz.c | 10 ++++++++-- - 2 files changed, 10 insertions(+), 2 deletions(-) - -diff --git a/php_xz.h b/php_xz.h -index 8368c4a..9908cb9 100644 ---- a/php_xz.h -+++ b/php_xz.h -@@ -20,6 +20,8 @@ - #ifndef PHP_XZ_H - # define PHP_XZ_H - -+#define PHP_XZ_VERSION "1.1.1" -+ - extern zend_module_entry xz_module_entry; - extern php_stream_wrapper php_stream_xz_wrapper; - -diff --git a/xz.c b/xz.c -index 243167d..e0a4d3a 100644 ---- a/xz.c -+++ b/xz.c -@@ -92,7 +92,7 @@ zend_module_entry xz_module_entry = { - NULL, /* PHP_RINIT(xz) */ - NULL, /* PHP_RSHUTDOWN(xz) */ - PHP_MINFO(xz), -- PHP_VERSION, -+ PHP_XZ_VERSION, - STANDARD_MODULE_PROPERTIES - }; - /* }}} */ -@@ -134,7 +134,13 @@ PHP_MINFO_FUNCTION(xz) - { - php_info_print_table_start(); - php_info_print_table_header(2, "xz support", "enabled"); -- php_info_print_table_header(2, "liblzma version", lzma_version_string()); -+ php_info_print_table_header(2, "xz extension version ", PHP_XZ_VERSION); -+ if (strcmp(LZMA_VERSION_STRING, lzma_version_string())) { -+ php_info_print_table_header(2, "liblzma headers version", LZMA_VERSION_STRING); -+ php_info_print_table_header(2, "liblzma library version", lzma_version_string()); -+ } else { -+ php_info_print_table_header(2, "liblzma version", lzma_version_string()); -+ } - php_info_print_table_end(); - - DISPLAY_INI_ENTRIES(); - -From 1aa1b2763257b9c733c5f636e6ace275e1600891 Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Fri, 9 Jul 2021 16:13:04 +0200 -Subject: [PATCH 2/2] only 1 header + rows - ---- - xz.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/xz.c b/xz.c -index e0a4d3a..832c13e 100644 ---- a/xz.c -+++ b/xz.c -@@ -134,12 +134,12 @@ PHP_MINFO_FUNCTION(xz) - { - php_info_print_table_start(); - php_info_print_table_header(2, "xz support", "enabled"); -- php_info_print_table_header(2, "xz extension version ", PHP_XZ_VERSION); -+ php_info_print_table_row(2, "xz extension version ", PHP_XZ_VERSION); - if (strcmp(LZMA_VERSION_STRING, lzma_version_string())) { -- php_info_print_table_header(2, "liblzma headers version", LZMA_VERSION_STRING); -- php_info_print_table_header(2, "liblzma library version", lzma_version_string()); -+ php_info_print_table_row(2, "liblzma headers version", LZMA_VERSION_STRING); -+ php_info_print_table_row(2, "liblzma library version", lzma_version_string()); - } else { -- php_info_print_table_header(2, "liblzma version", lzma_version_string()); -+ php_info_print_table_row(2, "liblzma version", lzma_version_string()); - } - php_info_print_table_end(); - diff --git a/pr3.patch b/pr3.patch deleted file mode 100644 index 0fe4fe9..0000000 --- a/pr3.patch +++ /dev/null @@ -1,157 +0,0 @@ -From 8d05ae5257dba8e077063d0023bd5cdeabf463ac Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Fri, 9 Jul 2021 16:57:55 +0200 -Subject: [PATCH] fix arginfo and build warnings - ---- - utils.c | 2 +- - utils.h | 2 +- - xz.c | 23 +++++++++++++---------- - xz_fopen_wrapper.c | 11 ++++++----- - 4 files changed, 21 insertions(+), 17 deletions(-) - -diff --git a/utils.c b/utils.c -index 45884a3..fd94186 100644 ---- a/utils.c -+++ b/utils.c -@@ -20,7 +20,7 @@ - - #include "php.h" - --void *memmerge(char *ptr1, char *ptr2, size_t len1, size_t len2) /* {{{ */ -+void *memmerge(void *ptr1, void *ptr2, size_t len1, size_t len2) /* {{{ */ - { - if ((ptr2 == NULL) || (len2 < 1)) { - return ptr1; -diff --git a/utils.h b/utils.h -index f2ccdac..929f249 100644 ---- a/utils.h -+++ b/utils.h -@@ -24,7 +24,7 @@ - /* Merges two memory fragments by reallocating the first one. - Returns a pointer to the first memory segment or, if reallocated, to the new - address. */ --void *memmerge(char *ptr1, char *ptr2, size_t len1, size_t len2); -+void *memmerge(void *ptr1, void *ptr2, size_t len1, size_t len2); - - #endif - -diff --git a/xz.c b/xz.c -index 243167d..5c80ee2 100644 ---- a/xz.c -+++ b/xz.c -@@ -38,15 +38,12 @@ - #endif - - /* {{{ arginfo */ --ZEND_BEGIN_ARG_INFO(arginfo_void, 0) --ZEND_END_ARG_INFO() -- - ZEND_BEGIN_ARG_INFO(arginfo_xzread, 0) - ZEND_ARG_INFO(0, fp) - ZEND_ARG_INFO(0, length) - ZEND_END_ARG_INFO() - --ZEND_BEGIN_ARG_INFO(arginfo_xzwrite, 0) -+ZEND_BEGIN_ARG_INFO_EX(arginfo_xzwrite, 0, 0, 2) - ZEND_ARG_INFO(0, fp) - ZEND_ARG_INFO(0, str) - ZEND_ARG_INFO(0, length) -@@ -67,13 +64,19 @@ ZEND_END_ARG_INFO() - ZEND_BEGIN_ARG_INFO(arginfo_xzdecode, 0) - ZEND_ARG_INFO(0, str) - ZEND_END_ARG_INFO() -+ -+ZEND_BEGIN_ARG_INFO_EX(arginfo_xzopen, 0, 0, 2) -+ ZEND_ARG_INFO(0, filename) -+ ZEND_ARG_INFO(0, mode) -+ ZEND_ARG_INFO(0, compression_level) -+ZEND_END_ARG_INFO() - /* }}} */ - - /* {{{ xz_functions[] */ - static const zend_function_entry xz_functions[] = { -- PHP_FE(xzdecode, arginfo_void) -- PHP_FE(xzopen, arginfo_void) -- PHP_FE(xzencode, arginfo_void) -+ PHP_FE(xzdecode, arginfo_xzdecode) -+ PHP_FE(xzopen, arginfo_xzopen) -+ PHP_FE(xzencode, arginfo_xzencode) - PHP_FALIAS(xzread, fread, arginfo_xzread) - PHP_FALIAS(xzwrite, fwrite, arginfo_xzwrite) - PHP_FALIAS(xzclose, fclose, arginfo_xzclose) -@@ -247,7 +250,7 @@ PHP_FUNCTION(xzencode) - - lzma_end(&strm); - -- RETURN_STRINGL(out, out_len); -+ RETURN_STRINGL((char *)out, out_len); - } - /* }}} */ - -@@ -299,14 +302,14 @@ PHP_FUNCTION(xzdecode) - strm.next_out = buff; - } - } -- -+ (void)status; // avoid -Wunused-but-set-variable warning - /* Merging last fragment. */ - out = memmerge(out, buff, out_len, XZ_BUFFER_SIZE - strm.avail_out); - out_len += XZ_BUFFER_SIZE - strm.avail_out; - - lzma_end(&strm); - -- RETURN_STRINGL(out, out_len); -+ RETURN_STRINGL((char *)out, out_len); - } - /* }}} */ - -diff --git a/xz_fopen_wrapper.c b/xz_fopen_wrapper.c -index 8bd2843..4dc75a9 100644 ---- a/xz_fopen_wrapper.c -+++ b/xz_fopen_wrapper.c -@@ -53,7 +53,7 @@ struct php_xz_stream_data_t { - int fd; - - /* The type of access required. */ -- char mode[4]; -+ char mode[64]; - - /* Compression level used. */ - unsigned long level; -@@ -69,7 +69,7 @@ static int php_xz_decompress(struct php_xz_stream_data_t *self) - - if (strm->avail_in == 0 && !php_stream_eof(self->stream)) { - strm->next_in = self->in_buf; -- strm->avail_in = php_stream_read(self->stream, self->in_buf, self->in_buf_sz); -+ strm->avail_in = php_stream_read(self->stream, (char *)self->in_buf, self->in_buf_sz); - } - - lzma_ret ret = lzma_code(strm, action); -@@ -92,14 +92,15 @@ static int php_xz_compress(struct php_xz_stream_data_t *self) - { - lzma_stream *strm = &self->strm; - lzma_action action = LZMA_RUN; -- int wrote = 0, to_write = strm->avail_in; -+ int to_write = strm->avail_in; - - while (strm->avail_in > 0) { - lzma_ret ret = lzma_code(strm, action); - size_t len = self->out_buf_sz - strm->avail_out; -- php_stream_write(self->stream, self->out_buf, len); -+ php_stream_write(self->stream, (char *)self->out_buf, len); - strm->next_out = self->out_buf; - strm->avail_out = self->out_buf_sz; -+ (void)ret; // avoid -Wunused-but-set-variable warning - } - - strm->next_in = self->in_buf; -@@ -266,7 +267,7 @@ static int php_xziop_close(php_stream *stream, int close_handle) - - if (strm->avail_out < self->out_buf_sz) { - size_t write_size = self->out_buf_sz - strm->avail_out; -- php_stream_write(self->stream, self->out_buf, write_size); -+ php_stream_write(self->stream, (char *)self->out_buf, write_size); - strm->next_out = self->out_buf; - strm->avail_out = self->out_buf_sz; - } -- cgit