From 6a509898d71ad4b31e4e4a00f42f7e8b00b7f03a Mon Sep 17 00:00:00 2001 From: Martin Matuska Date: Mon, 30 Jan 2017 01:39:03 +0100 Subject: [PATCH] Disable automatic detection of liblzo2 Replace liblzo with lzop in Travis CI builds Fix lzop tests Distribution of libarchive binaries linked against LZO violates LZO GPL license. liblzo2 can still be linked with --with-lzo2 --- .travis.yml | 4 +- CMakeLists.txt | 38 +++++++++++-------- configure.ac | 4 +- libarchive/test/test_fuzz.c | 4 ++ libarchive/test/test_read_filter_lzop.c | 9 +++-- .../test_read_filter_lzop_multiple_parts.c | 8 +++- libarchive/test/test_write_filter_lzop.c | 6 +-- 7 files changed, 45 insertions(+), 28 deletions(-) diff --git a/.travis.yml b/.travis.yml index 44cbe2198..d7fe8372e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,8 +7,8 @@ addons: - libacl1-dev - libbz2-dev - liblzma-dev - - liblzo2-dev - libzip-dev + - lzop os: - linux - osx @@ -25,6 +25,6 @@ matrix: before_install: - if [ `uname` = "Darwin" ]; then brew update; fi install: - - if [ `uname` = "Darwin" ]; then brew install xz lzo lz4; fi + - if [ `uname` = "Darwin" ]; then brew install xz lzop lz4; fi script: - build/ci_build.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index cda1506f2..eb36b5b99 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -179,13 +179,15 @@ include(CTest) OPTION(ENABLE_NETTLE "Enable use of Nettle" ON) OPTION(ENABLE_OPENSSL "Enable use of OpenSSL" ON) -OPTION(ENABLE_LZMA "Enable the use of the system found LZMA library if found" ON) -OPTION(ENABLE_ZLIB "Enable the use of the system found ZLIB library if found" ON) -OPTION(ENABLE_BZip2 "Enable the use of the system found BZip2 library if found" ON) -OPTION(ENABLE_LIBXML2 "Enable the use of the system found libxml2 library if found" ON) -OPTION(ENABLE_EXPAT "Enable the use of the system found EXPAT library if found" ON) -OPTION(ENABLE_PCREPOSIX "Enable the use of the system found PCREPOSIX library if found" ON) -OPTION(ENABLE_LibGCC "Enable the use of the system found LibGCC library if found" ON) +OPTION(ENABLE_LZO "Enable the use of the system LZO library if found" OFF) +OPTION(ENABLE_LZMA "Enable the use of the system LZMA library if found" ON) + +OPTION(ENABLE_ZLIB "Enable the use of the system ZLIB library if found" ON) +OPTION(ENABLE_BZip2 "Enable the use of the system BZip2 library if found" ON) +OPTION(ENABLE_LIBXML2 "Enable the use of the system libxml2 library if found" ON) +OPTION(ENABLE_EXPAT "Enable the use of the system EXPAT library if found" ON) +OPTION(ENABLE_PCREPOSIX "Enable the use of the system PCREPOSIX library if found" ON) +OPTION(ENABLE_LibGCC "Enable the use of the system LibGCC library if found" ON) # CNG is used for encrypt/decrypt Zip archives on Windows. OPTION(ENABLE_CNG "Enable the use of CNG(Crypto Next Generation)" ON) @@ -477,15 +479,19 @@ ENDIF(LIBLZMA_FOUND) # # Find LZO2 # -IF (LZO2_INCLUDE_DIR) - # Already in cache, be silent - SET(LZO2_FIND_QUIETLY TRUE) -ENDIF (LZO2_INCLUDE_DIR) - -FIND_PATH(LZO2_INCLUDE_DIR lzo/lzoconf.h) -FIND_LIBRARY(LZO2_LIBRARY NAMES lzo2 liblzo2) -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(LZO2 DEFAULT_MSG LZO2_LIBRARY LZO2_INCLUDE_DIR) +IF(ENABLE_LZO) + IF (LZO2_INCLUDE_DIR) + # Already in cache, be silent + SET(LZO2_FIND_QUIETLY TRUE) + ENDIF (LZO2_INCLUDE_DIR) + + FIND_PATH(LZO2_INCLUDE_DIR lzo/lzoconf.h) + FIND_LIBRARY(LZO2_LIBRARY NAMES lzo2 liblzo2) + INCLUDE(FindPackageHandleStandardArgs) + FIND_PACKAGE_HANDLE_STANDARD_ARGS(LZO2 DEFAULT_MSG LZO2_LIBRARY LZO2_INCLUDE_DIR) +ELSE(ENABLE_LZO) + SET(LIBZMA_FOUND FALSE) # Override cached value +ENDIF(ENABLE_LZO) IF(LZO2_FOUND) SET(HAVE_LIBLZO2 1) SET(HAVE_LZO_LZOCONF_H 1) diff --git a/configure.ac b/configure.ac index 0afb59cef..f3b8fda40 100644 --- a/configure.ac +++ b/configure.ac @@ -379,9 +379,9 @@ if test "x$with_lzma" != "xno"; then fi AC_ARG_WITH([lzo2], - AS_HELP_STRING([--without-lzo2], [Don't build support for lzop through liblzo2])) + AS_HELP_STRING([--with-lzo2], [Build with LZO support from liblzo2])) -if test "x$with_lzo2" != "xno"; then +if test "x$with_lzo2" == "xyes"; then AC_CHECK_HEADERS([lzo/lzoconf.h lzo/lzo1x.h]) AC_CHECK_LIB(lzo2,lzo1x_decompress_safe) fi diff --git a/libarchive/test/test_fuzz.c b/libarchive/test/test_fuzz.c index ff064c07d..71bf3ffb9 100644 --- a/libarchive/test/test_fuzz.c +++ b/libarchive/test/test_fuzz.c @@ -406,10 +406,12 @@ DEFINE_TEST(test_fuzz_tar) "test_read_format_tar_empty_filename.tar", NULL }; +#if HAVE_LIBLZO2 && HAVE_LZO_LZO1X_H && HAVE_LZO_LZOCONF_H static const char *fileset9[] = { "test_compat_lzop_1.tar.lzo", NULL }; +#endif static const struct files filesets[] = { {0, fileset1}, /* Exercise bzip2 decompressor. */ {1, fileset1}, @@ -420,7 +422,9 @@ DEFINE_TEST(test_fuzz_tar) {0, fileset6}, /* Exercise xz decompressor. */ {0, fileset7}, {0, fileset8}, +#if HAVE_LIBLZO2 && HAVE_LZO_LZO1X_H && HAVE_LZO_LZOCONF_H {0, fileset9}, /* Exercise lzo decompressor. */ +#endif {1, NULL} }; test_fuzz(filesets); diff --git a/libarchive/test/test_read_filter_lzop.c b/libarchive/test/test_read_filter_lzop.c index 86a5e6e84..acce6a4c2 100644 --- a/libarchive/test/test_read_filter_lzop.c +++ b/libarchive/test/test_read_filter_lzop.c @@ -39,13 +39,16 @@ DEFINE_TEST(test_read_filter_lzop) assert((a = archive_read_new()) != NULL); r = archive_read_support_filter_lzop(a); if (r != ARCHIVE_OK) { - if (r == ARCHIVE_WARN && !canLzop()) { + if (!canLzop()) { assertEqualInt(ARCHIVE_OK, archive_read_free(a)); skipping("lzop compression is not supported " "on this platform"); - } else + return; + } else if (r != ARCHIVE_WARN) { assertEqualIntA(a, ARCHIVE_OK, r); - return; + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); + return; + } } assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); assertEqualIntA(a, ARCHIVE_OK, diff --git a/libarchive/test/test_read_filter_lzop_multiple_parts.c b/libarchive/test/test_read_filter_lzop_multiple_parts.c index 3b0febbd7..82eaf3539 100644 --- a/libarchive/test/test_read_filter_lzop_multiple_parts.c +++ b/libarchive/test/test_read_filter_lzop_multiple_parts.c @@ -36,12 +36,16 @@ DEFINE_TEST(test_read_filter_lzop_multiple_parts) assert((a = archive_read_new()) != NULL); r = archive_read_support_filter_lzop(a); if (r != ARCHIVE_OK) { - if (r == ARCHIVE_WARN && !canLzop()) { - assertEqualInt(ARCHIVE_OK, archive_read_free(a)); + if (!canLzop()) { skipping("lzop compression is not supported " "on this platform"); + } else if (r == ARCHIVE_WARN) { + skipping("lzop multiple parts decoding is not " + "supported via external program"); + } else assertEqualIntA(a, ARCHIVE_OK, r); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); return; } assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); diff --git a/libarchive/test/test_write_filter_lzop.c b/libarchive/test/test_write_filter_lzop.c index a32932c69..92db7bf3d 100644 --- a/libarchive/test/test_write_filter_lzop.c +++ b/libarchive/test/test_write_filter_lzop.c @@ -43,12 +43,12 @@ DEFINE_TEST(test_write_filter_lzop) assert((a = archive_write_new()) != NULL); r = archive_write_add_filter_lzop(a); + assertEqualInt(ARCHIVE_OK, archive_write_free(a)); if (r != ARCHIVE_OK) { if (canLzop() && r == ARCHIVE_WARN) use_prog = 1; else { skipping("lzop writing not supported on this platform"); - assertEqualInt(ARCHIVE_OK, archive_write_free(a)); return; } } @@ -92,7 +92,7 @@ DEFINE_TEST(test_write_filter_lzop) assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); r = archive_read_support_filter_lzop(a); - if (r == ARCHIVE_WARN) { + if (r == ARCHIVE_WARN && !use_prog) { skipping("Can't verify lzop writing by reading back;" " lzop reading not fully supported on this platform"); } else { @@ -212,7 +212,7 @@ DEFINE_TEST(test_write_filter_lzop) assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); r = archive_read_support_filter_lzop(a); - if (r == ARCHIVE_WARN) { + if (r == ARCHIVE_WARN && !use_prog) { skipping("lzop reading not fully supported on this platform"); } else { assertEqualIntA(a, ARCHIVE_OK, -- 2.47.2