summaryrefslogtreecommitdiffstats
path: root/7.patch
diff options
context:
space:
mode:
Diffstat (limited to '7.patch')
-rw-r--r--7.patch177
1 files changed, 177 insertions, 0 deletions
diff --git a/7.patch b/7.patch
new file mode 100644
index 0000000..3bc5393
--- /dev/null
+++ b/7.patch
@@ -0,0 +1,177 @@
+From 049d21d1865db4355a4b8598aa705ba2c3f3e7f1 Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Tue, 30 Jan 2018 09:24:02 +0100
+Subject: [PATCH 1/3] fix build warning [-Wunused-variable]
+
+---
+ zstd.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/zstd.c b/zstd.c
+index c382c83..2257280 100644
+--- a/zstd.c
++++ b/zstd.c
+@@ -294,7 +294,6 @@ ZEND_FUNCTION(zstd_uncompress_dict)
+
+ ZEND_MINFO_FUNCTION(zstd)
+ {
+- char buffer[128];
+ php_info_print_table_start();
+ php_info_print_table_row(2, "Zstd support", "enabled");
+ php_info_print_table_row(2, "Extension Version", PHP_ZSTD_EXT_VERSION);
+
+From 1bec6a0eb38159148e447b8126745d85a3a222e1 Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Tue, 30 Jan 2018 09:26:19 +0100
+Subject: [PATCH 2/3] add --with-libzstd option to use system library
+
+---
+ .gitignore | 2 ++
+ config.m4 | 35 +++++++++++++++++++++++++++++------
+ 2 files changed, 31 insertions(+), 6 deletions(-)
+
+diff --git a/.gitignore b/.gitignore
+index b732353..c4bbefa 100644
+--- a/.gitignore
++++ b/.gitignore
+@@ -22,3 +22,5 @@ run-tests.php
+ /build
+ /include
+ /modules
++ltmain.sh.backup
++tmp-php.ini
+diff --git a/config.m4 b/config.m4
+index 5a117e1..de86242 100644
+--- a/config.m4
++++ b/config.m4
+@@ -24,16 +24,39 @@ fi
+ PHP_ARG_ENABLE(zstd, whether to enable zstd support,
+ [ --enable-zstd Enable zstd support])
+
++PHP_ARG_WITH(libzstd, whether to use system zstd library,
++[ --with-libzsd Use system zstd library], no, no)
++
+ if test "$PHP_ZSTD" != "no"; then
+
+- ZSTD_COMMON_SOURCES="zstd/lib/common/entropy_common.c zstd/lib/common/error_private.c zstd/lib/common/fse_decompress.c zstd/lib/common/pool.c zstd/lib/common/threading.c zstd/lib/common/xxhash.c zstd/lib/common/zstd_common.c"
+- ZSTD_COMPRESS_SOURCES="zstd/lib/compress/fse_compress.c zstd/lib/compress/huf_compress.c zstd/lib/compress/zstd_compress.c zstd/lib/compress/zstdmt_compress.c"
+- ZSTD_DECOMPRESS_SOURCES="zstd/lib/decompress/huf_decompress.c zstd/lib/decompress/zstd_decompress.c"
++ if test "$PHP_LIBZSTD" != "no"; then
++ AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+
+- PHP_ADD_INCLUDE(zstd/lib/common)
+- PHP_ADD_INCLUDE(zstd/lib)
++ AC_MSG_CHECKING(for libzstd)
++ if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libzstd; then
++ if $PKG_CONFIG libzstd --atleast-version 1; then
++ LIBZSTD_CFLAGS=`$PKG_CONFIG libzstd --cflags`
++ LIBZSTD_LIBDIR=`$PKG_CONFIG libzstd --libs`
++ LIBZSTD_VERSON=`$PKG_CONFIG libzstd --modversion`
++ AC_MSG_RESULT(from pkgconfig: version $LIBZSTD_VERSON)
++ else
++ AC_MSG_ERROR(system libzstd is too old)
++ fi
++ else
++ AC_MSG_ERROR(pkg-config not found)
++ fi
++ PHP_EVAL_LIBLINE($LIBZSTD_LIBDIR, ZSTD_SHARED_LIBADD)
++ PHP_EVAL_INCLINE($LIBZSTD_CFLAGS)
++ else
++ ZSTD_COMMON_SOURCES="zstd/lib/common/entropy_common.c zstd/lib/common/error_private.c zstd/lib/common/fse_decompress.c zstd/lib/common/pool.c zstd/lib/common/threading.c zstd/lib/common/xxhash.c zstd/lib/common/zstd_common.c"
++ ZSTD_COMPRESS_SOURCES="zstd/lib/compress/fse_compress.c zstd/lib/compress/huf_compress.c zstd/lib/compress/zstd_compress.c zstd/lib/compress/zstdmt_compress.c"
++ ZSTD_DECOMPRESS_SOURCES="zstd/lib/decompress/huf_decompress.c zstd/lib/decompress/zstd_decompress.c"
+
++ PHP_ADD_INCLUDE(zstd/lib/common)
++ PHP_ADD_INCLUDE(zstd/lib)
++ fi
+ PHP_NEW_EXTENSION(zstd, zstd.c $ZSTD_COMMON_SOURCES $ZSTD_COMPRESS_SOURCES $ZSTD_DECOMPRESS_SOURCES, $ext_shared)
++ PHP_SUBST(ZSTD_SHARED_LIBADD)
+
+ ifdef([PHP_INSTALL_HEADERS],
+ [
+@@ -45,7 +68,7 @@ fi
+
+ dnl coverage
+ PHP_ARG_ENABLE(coverage, whether to enable coverage support,
+-[ --enable-coverage Enable coverage support], no, no)
++[ --enable-coverage Enable coverage support], no, no)
+
+ if test "$PHP_COVERAGE" != "no"; then
+ EXTRA_CFLAGS="--coverage"
+
+From 297f3761d19189c1abc4ad5975013fb459bf796d Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Tue, 30 Jan 2018 09:27:01 +0100
+Subject: [PATCH 3/3] relax test (few char diff across libzstd versions)
+
+---
+ tests/008.phpt | 44 ++++++++++++++++++++++----------------------
+ tests/dictionary.phpt | 2 +-
+ 2 files changed, 23 insertions(+), 23 deletions(-)
+
+diff --git a/tests/008.phpt b/tests/008.phpt
+index 7b74976..0ab3666 100644
+--- a/tests/008.phpt
++++ b/tests/008.phpt
+@@ -30,28 +30,28 @@ check_compress($data, 0);
+ *** Data size ***
+ 3547
+ *** Compression Level ***
+-1 -- 1874 -- true
+-2 -- 1847 -- true
+-3 -- 1840 -- true
+-4 -- 1815 -- true
+-5 -- 1805 -- true
+-6 -- 1803 -- true
+-7 -- 1803 -- true
+-8 -- 1803 -- true
+-9 -- 1803 -- true
+-10 -- 1803 -- true
+-11 -- 1800 -- true
+-12 -- 1796 -- true
+-13 -- 1796 -- true
+-14 -- 1796 -- true
+-15 -- 1796 -- true
+-16 -- 1796 -- true
+-17 -- 1796 -- true
+-18 -- 1796 -- true
+-19 -- 1796 -- true
+-20 -- 1796 -- true
+-21 -- 1796 -- true
+-22 -- 1796 -- true
++1 -- 1%d -- true
++2 -- 1%d -- true
++3 -- 1%d -- true
++4 -- 1%d -- true
++5 -- 1%d -- true
++6 -- 1%d -- true
++7 -- 1%d -- true
++8 -- 1%d -- true
++9 -- 1%d -- true
++10 -- 1%d -- true
++11 -- 1%d -- true
++12 -- 1%d -- true
++13 -- 1%d -- true
++14 -- 1%d -- true
++15 -- 1%d -- true
++16 -- 1%d -- true
++17 -- 1%d -- true
++18 -- 1%d -- true
++19 -- 1%d -- true
++20 -- 1%d -- true
++21 -- 1%d -- true
++22 -- 1%d -- true
+ *** Invalid Compression Level ***
+
+ Warning: zstd_compress: compression level (100) must be within 1..22 in %s on line %d
+diff --git a/tests/dictionary.phpt b/tests/dictionary.phpt
+index c5c2ab6..b3455b6 100644
+--- a/tests/dictionary.phpt
++++ b/tests/dictionary.phpt
+@@ -24,5 +24,5 @@ check_compress_dict($data, $dictionary);
+ *** Data size ***
+ 3547
+ *** Dictionary Compression ***
+-142 -- 1924 -- true
++142 -- 1%d -- true
+ ===Done===