horde_lz4 with system liblz4
Remi Collet <[email protected]>
| Newsgroups | gmane.comp.horde.devel |
|---|---|
| Message-ID | <[email protected]> |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, I plan to submit horde_lz4 to official Fedora repository. But Fedora Guidelines don't allow to use bundle library[1] Can you please consider the attached patch which allow to 1/ build with system liblz4 (add --with-liblz4) => should be noop for standard build 2/ fix build with recent liblz4 r222 => LZ4_uncompress is deprecated and have be removed With this patch applied and with liblz4 r222: $ php -d extension=modules/horde_lz4.so /usr/bin/phpunit test PHPUnit 4.2.6 by Sebastian Bergmann. ............ Time: 15 ms, Memory: 2.75Mb OK (12 tests, 14 assertions) Regards, Remi [1] https://fedoraproject.org/wiki/Packaging:No_Bundled_Libraries -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlQXBsgACgkQYUppBSnxahgEjACdGdZPa/LgjQXRsV99wiRrxF3+ oV8An2Tp5QD/mQDf27oYyv5vI0upAo9f =r1jB -----END PGP SIGNATURE----- -- dev mailing list Frequently Asked Questions: http://wiki.horde.org/FAQ To unsubscribe, mail: [email protected]
horde-lz4-systemlib.patch
(text/x-patch, 1.8 KB)
diff -up ./config.m4.old ./config.m4
--- ./config.m4.old 2014-09-15 17:01:16.231167165 +0200
+++ ./config.m4 2014-09-15 17:14:11.813781559 +0200
@@ -24,9 +24,36 @@ fi
PHP_ARG_ENABLE(horde_lz4, whether to enable horde_lz4 support,
[ --enable-horde_lz4 Enable horde_lz4 support])
+PHP_ARG_WITH(liblz4, whether to use system liblz4,
+[ --with-liblz4 Use system liblz4], no, no)
+
if test "$PHP_HORDE_LZ4" != "no"; then
- PHP_NEW_EXTENSION(horde_lz4, horde_lz4.c lz4.c lz4hc.c, $ext_shared)
+ sources=horde_lz4.c
+
+ if test "$PHP_LIBLZ4" != "no"; then
+ AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+ AC_MSG_CHECKING(liblz4 version)
+ if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists liblz4; then
+ LIBLZ4_INCLUDE=`$PKG_CONFIG liblz4 --cflags`
+ LIBLZ4_LIBRARY=`$PKG_CONFIG liblz4 --libs`
+ LIBLZ4_VERSION=`$PKG_CONFIG liblz4 --modversion`
+ fi
+
+ if test -z "$LIBLZ4_VERSION"; then
+ AC_MSG_RESULT(version not found)
+ AC_MSG_ERROR(Please reinstall libzl4)
+ else
+ AC_MSG_RESULT($LIBLZ4_VERSION)
+ fi
+ PHP_EVAL_INCLINE($LIBLZ4_INCLUDE)
+ PHP_EVAL_LIBLINE($LIBLZ4_LIBRARY, HORDE_LZ4_SHARED_LIBADD)
+ PHP_EVAL_LIBLINE($LIBLZ4_LIBRARY, HORDE_LZ4_SHARED_LIBADD)
+ else
+ sources="$sources lz4.c lz4hc.c"
+ fi
+ PHP_NEW_EXTENSION(horde_lz4, $sources, $ext_shared)
+ PHP_SUBST(HORDE_LZ4_SHARED_LIBADD)
ifdef([PHP_INSTALL_HEADERS],
[
diff -up ./horde_lz4.c.old ./horde_lz4.c
--- ./horde_lz4.c.old 2014-09-15 17:24:33.521673922 +0200
+++ ./horde_lz4.c 2014-09-15 17:25:24.225908322 +0200
@@ -150,7 +150,7 @@ PHP_FUNCTION(horde_lz4_uncompress)
RETURN_FALSE;
}
- output_len = LZ4_uncompress(p + header_offset, output, data_len);
+ output_len = LZ4_decompress_fast(p + header_offset, output, data_len);
if (output_len <= 0) {
RETVAL_FALSE;