File lower-libarchive-minimum-version.patch of Package ark
From e8b460a6c6fd90d95fc8c7ca19f2c37fc199bdb9 Mon Sep 17 00:00:00 2001
From: Wolfgang Bauer <wbauer@tmo.at>
Date: Mon, 27 Mar 2017 15:02:00 +0200
Subject: [PATCH] Revert "Bump libarchive minumum version to 3.2"
This reverts commit 38d7c46a0264cbc037197b5401cfd094e000db9d to make it
build on Leap 42 (with libarchive 3.1.2).
Shouldn't make a difference when really building against libarchive
3.2.0 or higher.
---
CMakeLists.txt | 2 +-
plugins/libarchive/CMakeLists.txt | 22 +++++++++++++++++++---
plugins/libarchive/readwritelibarchiveplugin.cpp | 4 ++++
3 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8383134..ceb1060 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -62,7 +62,7 @@ if(NOT Qt5Test_FOUND)
set(BUILD_TESTING OFF CACHE BOOL "Build the testing tree.")
endif()
-find_package(LibArchive 3.2.0 REQUIRED)
+find_package(LibArchive 3.1.0 REQUIRED)
set_package_properties(LibArchive PROPERTIES
URL "http://www.libarchive.org/"
DESCRIPTION "A library for dealing with a wide variety of archive file formats"
diff --git a/plugins/libarchive/CMakeLists.txt b/plugins/libarchive/CMakeLists.txt
index fa2a13d..bafe120 100644
--- a/plugins/libarchive/CMakeLists.txt
+++ b/plugins/libarchive/CMakeLists.txt
@@ -2,10 +2,15 @@ include_directories(${LibArchive_INCLUDE_DIRS})
########### next target ###############
set(SUPPORTED_LIBARCHIVE_READWRITE_MIMETYPES "application/x-tar;application/x-compressed-tar;application/x-bzip-compressed-tar;application/x-tarz;application/x-xz-compressed-tar;")
-set(SUPPORTED_LIBARCHIVE_READWRITE_MIMETYPES "${SUPPORTED_LIBARCHIVE_READWRITE_MIMETYPES}application/x-lzma-compressed-tar;application/x-lzip-compressed-tar;application/x-tzo;application/x-lrzip-compressed-tar;application/x-lz4-compressed-tar;")
+set(SUPPORTED_LIBARCHIVE_READWRITE_MIMETYPES "${SUPPORTED_LIBARCHIVE_READWRITE_MIMETYPES}application/x-lzma-compressed-tar;application/x-lzip-compressed-tar;application/x-tzo;application/x-lrzip-compressed-tar;")
set(SUPPORTED_LIBARCHIVE_READONLY_MIMETYPES "application/vnd.debian.binary-package;application/x-deb;application/x-cd-image;application/x-bcpio;application/x-cpio;application/x-cpio-compressed;application/x-sv4cpio;application/x-sv4crc;")
set(SUPPORTED_LIBARCHIVE_READONLY_MIMETYPES "${SUPPORTED_LIBARCHIVE_READONLY_MIMETYPES}application/x-rpm;application/x-source-rpm;application/vnd.ms-cab-compressed;application/x-xar;application/x-iso9660-appimage;application/x-archive;")
+if(LibArchive_VERSION VERSION_EQUAL "3.2.0" OR
+ LibArchive_VERSION VERSION_GREATER "3.2.0")
+ set(SUPPORTED_LIBARCHIVE_READWRITE_MIMETYPES "${SUPPORTED_LIBARCHIVE_READWRITE_MIMETYPES}application/x-lz4-compressed-tar;")
+endif()
+
set(INSTALLED_LIBARCHIVE_PLUGINS "")
set(kerfuffle_libarchive_readonly_SRCS libarchiveplugin.cpp readonlylibarchiveplugin.cpp ark_debug.cpp)
@@ -46,8 +51,14 @@ set(SUPPORTED_READWRITE_MIMETYPES
\"application/x-lzma-compressed-tar\",
\"application/x-lzip-compressed-tar\",
\"application/x-tzo\",
- \"application/x-lrzip-compressed-tar\",
- \"application/x-lz4-compressed-tar")
+ \"application/x-lrzip-compressed-tar")
+
+if(LibArchive_VERSION VERSION_EQUAL "3.2.0" OR
+ LibArchive_VERSION VERSION_GREATER "3.2.0")
+ set(SUPPORTED_READWRITE_MIMETYPES
+ "${SUPPORTED_READWRITE_MIMETYPES}\",
+ \"application/x-lz4-compressed-tar")
+endif()
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/kerfuffle_libarchive_readonly.json.cmake
@@ -60,6 +71,11 @@ configure_file(
kerfuffle_add_plugin(kerfuffle_libarchive_readonly ${kerfuffle_libarchive_readonly_SRCS})
kerfuffle_add_plugin(kerfuffle_libarchive ${kerfuffle_libarchive_readwrite_SRCS})
+if(LibArchive_VERSION VERSION_EQUAL "3.2.0" OR
+ LibArchive_VERSION VERSION_GREATER "3.2.0")
+ target_compile_definitions(kerfuffle_libarchive PRIVATE -DHAVE_LIBARCHIVE_3_2_0)
+endif()
+
target_link_libraries(kerfuffle_libarchive_readonly ${LibArchive_LIBRARIES})
target_link_libraries(kerfuffle_libarchive ${LibArchive_LIBRARIES})
diff --git a/plugins/libarchive/readwritelibarchiveplugin.cpp b/plugins/libarchive/readwritelibarchiveplugin.cpp
index b3f4e63..f71b7a7 100644
--- a/plugins/libarchive/readwritelibarchiveplugin.cpp
+++ b/plugins/libarchive/readwritelibarchiveplugin.cpp
@@ -291,9 +291,11 @@ bool ReadWriteLibarchivePlugin::initializeWriterFilters()
ret = archive_write_add_filter_lrzip(m_archiveWriter.data());
requiresExecutable = true;
break;
+#ifdef HAVE_LIBARCHIVE_3_2_0
case ARCHIVE_FILTER_LZ4:
ret = archive_write_add_filter_lz4(m_archiveWriter.data());
break;
+#endif
case ARCHIVE_FILTER_NONE:
ret = archive_write_add_filter_none(m_archiveWriter.data());
break;
@@ -343,9 +345,11 @@ bool ReadWriteLibarchivePlugin::initializeNewFileWriterFilters(const Compression
qCDebug(ARK) << "Detected lrzip compression for new file";
ret = archive_write_add_filter_lrzip(m_archiveWriter.data());
requiresExecutable = true;
+#ifdef HAVE_LIBARCHIVE_3_2_0
} else if (filename().right(3).toUpper() == QLatin1String("LZ4")) {
qCDebug(ARK) << "Detected lz4 compression for new file";
ret = archive_write_add_filter_lz4(m_archiveWriter.data());
+#endif
} else if (filename().right(3).toUpper() == QLatin1String("TAR")) {
qCDebug(ARK) << "Detected no compression for new file (pure tar)";
ret = archive_write_add_filter_none(m_archiveWriter.data());
--
2.10.2