From 41be5befb7615c262565390073d41286fb9d7983 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 6 Jan 2017 05:39:00 +0100 Subject: php-lz4: 0.3.2 --- REFLECTION | 8 +++- php-ext-lz4-pr18.patch | 122 ------------------------------------------------- php-lz4.spec | 13 +++--- 3 files changed, 13 insertions(+), 130 deletions(-) delete mode 100644 php-ext-lz4-pr18.patch diff --git a/REFLECTION b/REFLECTION index 60fa0a7..b93299d 100644 --- a/REFLECTION +++ b/REFLECTION @@ -1,4 +1,10 @@ -Extension [ extension #103 lz4 version 0.3.1 ] { +Extension [ extension #103 lz4 version 0.3.2 ] { + + - Constants [3] { + Constant [ integer LZ4_CLEVEL_MIN ] { 3 } + Constant [ integer LZ4_CLEVEL_MAX ] { 16 } + Constant [ integer LZ4_VERSION ] { 10705 } + } - Functions { Function [ function lz4_compress ] { diff --git a/php-ext-lz4-pr18.patch b/php-ext-lz4-pr18.patch deleted file mode 100644 index c2f6058..0000000 --- a/php-ext-lz4-pr18.patch +++ /dev/null @@ -1,122 +0,0 @@ -From 408423281fa767b98bb66269fe098ad166c6fa16 Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Thu, 5 Jan 2017 10:46:14 +0100 -Subject: [PATCH] improve use of system liblz4 - ---- - lz4.c | 50 ++++++++++++++++++++++++++++++++++++++++++-------- - tests/011.phpt | 4 ++-- - 2 files changed, 44 insertions(+), 10 deletions(-) - -diff --git a/lz4.c b/lz4.c -index 27e3f66..175516e 100644 ---- a/lz4.c -+++ b/lz4.c -@@ -35,6 +35,19 @@ - #include "lz4.h" - #include "lz4hc.h" - -+#if defined(LZ4HC_CLEVEL_MAX) -+/* version >= 1.7.5 */ -+#define PHP_LZ4_CLEVEL_MAX LZ4HC_CLEVEL_MAX -+ -+#elif defined (LZ4HC_MAX_CLEVEL) -+/* version >= 1.7.3 */ -+#define PHP_LZ4_CLEVEL_MAX LZ4HC_MAX_CLEVEL -+ -+#else -+/* older versions */ -+#define PHP_LZ4_CLEVEL_MAX 16 -+#endif -+ - static ZEND_FUNCTION(lz4_compress); - static ZEND_FUNCTION(lz4_uncompress); - -@@ -56,19 +69,40 @@ static zend_function_entry lz4_functions[] = { - ZEND_FE_END - }; - -+ -+static PHP_MINIT_FUNCTION(lz4) -+{ -+ REGISTER_LONG_CONSTANT("LZ4_CLEVEL_MAX", PHP_LZ4_CLEVEL_MAX, CONST_CS | CONST_PERSISTENT); -+ -+ return SUCCESS; -+} -+ - ZEND_MINFO_FUNCTION(lz4) - { -- char buffer[128]; - php_info_print_table_start(); - php_info_print_table_row(2, "LZ4 support", "enabled"); - php_info_print_table_row(2, "Extension Version", LZ4_EXT_VERSION); --#ifdef HAVE_LIBLZ4 -- snprintf(buffer, sizeof(buffer), "%s", "system library"); --#else -+#if !defined(HAVE_LIBLZ4) -+ /* Bundled library */ -+ php_info_print_table_row(2, "LZ4 Version", LZ4_versionString()); -+#elif defined(LZ4_VERSION_MAJOR) -+ /* Recent system library */ -+ { -+ char buffer[128]; -+ - snprintf(buffer, sizeof(buffer), "%d.%d.%d", - LZ4_VERSION_MAJOR, LZ4_VERSION_MINOR, LZ4_VERSION_RELEASE); -+ php_info_print_table_row(2, "LZ4 headers Version", buffer); -+ -+ /* LZ4_versionString is not usable, see https://github.com/lz4/lz4/issues/301 */ -+ snprintf(buffer, sizeof(buffer), "%d.%d.%d", -+ LZ4_versionNumber()/10000, (LZ4_versionNumber()/100)%100, LZ4_versionNumber()%100); -+ php_info_print_table_row(2, "LZ4 library Version", buffer); -+ } -+#else -+ /* Old system library */ -+ php_info_print_table_row(2, "LZ4 Version", "system library"); - #endif -- php_info_print_table_row(2, "LZ4 Version", buffer); - php_info_print_table_end(); - } - -@@ -78,7 +112,7 @@ zend_module_entry lz4_module_entry = { - #endif - "lz4", - lz4_functions, -- NULL, -+ PHP_MINIT(lz4), - NULL, - NULL, - NULL, -@@ -99,7 +133,7 @@ static ZEND_FUNCTION(lz4_compress) - char *output; - int output_len, data_len, dst_len; - long level = 0; -- long maxLevel = (long)LZ4HC_CLEVEL_MAX; -+ long maxLevel = (long)PHP_LZ4_CLEVEL_MAX; - char *extra = NULL; - #if ZEND_MODULE_API_NO >= 20141001 - size_t extra_len = -1; -@@ -147,7 +181,7 @@ static ZEND_FUNCTION(lz4_compress) - } else { - if (level > maxLevel || level < 0) { - zend_error(E_WARNING, "lz4_compress: compression level (%ld)" -- " must be within 1..%d", level, maxLevel); -+ " must be within 1..%ld", level, maxLevel); - efree(output); - RETURN_FALSE; - } -diff --git a/tests/011.phpt b/tests/011.phpt -index 8e5fe3c..6b521ae 100644 ---- a/tests/011.phpt -+++ b/tests/011.phpt -@@ -45,8 +45,8 @@ check_compress($data, -1); - 8 -- 2686 -- true - 9 -- 2686 -- true - 10 -- 2686 -- true --11 -- 2683 -- true --12 -- 2683 -- true -+11 -- 26%d -- true -+12 -- 26%d -- true - *** Invalid Compression Level *** - 100 -- 0 -- false - -1 -- 0 -- false diff --git a/php-lz4.spec b/php-lz4.spec index f8a5a0c..c20722b 100644 --- a/php-lz4.spec +++ b/php-lz4.spec @@ -11,7 +11,7 @@ %scl_package php-lz4 %endif -%global gh_commit 08a5e24ea13a35e820dc222aa13230d313caa6ae +%global gh_commit 1cf284648c3e40317ea77a06a5636722bbf2be35 %global gh_short %(c=%{gh_commit}; echo ${c:0:7}) %global gh_owner kjdev %global gh_project php-ext-lz4 @@ -22,20 +22,17 @@ Summary: LZ4 Extension for PHP Name: %{?sub_prefix}php-lz4 -Version: 0.3.1 +Version: 0.3.2 %if 0%{?gh_date:1} Release: 0.2.%{gh_date}git%{gh_short}%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} %else -Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} %endif License: MIT Group: Development/Languages 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 -# https://github.com/kjdev/php-ext-lz4/pull/18 -Patch0: %{gh_project}-pr18.patch - BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildRequires: %{?scl_prefix}php-devel BuildRequires: lz4-devel @@ -86,7 +83,6 @@ Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSIO mv %{gh_project}-%{gh_commit} NTS cd NTS -%patch0 -p1 -b .pr18 # Use the system library rm -r lz4 @@ -202,6 +198,9 @@ rm -rf %{buildroot} %changelog +* Fri Jan 6 2017 Remi Collet - 0.3.2-1 +- update to 0.3.2 + * Thu Jan 5 2017 Remi Collet - 0.3.1-2 - test build for https://github.com/kjdev/php-ext-lz4/pull/18 -- cgit