Commit cdf979cd authored by Elvis Angelaccio's avatar Elvis Angelaccio
Browse files

Require libarchive 3.3.3

libarchive 3.3.3 has been released more than one year ago and most
distributions ship it by now.

By requiring this version, we can drop the custom mimetype for the ztsd
format and all the ifdefs to handle older libarchive versions.
parent 816c123f
......@@ -59,7 +59,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.3.3 REQUIRED)
set_package_properties(LibArchive PROPERTIES
URL "https://www.libarchive.org/"
DESCRIPTION "A library for dealing with a wide variety of archive file formats"
......@@ -71,11 +71,6 @@ set_package_properties(LibZip PROPERTIES
DESCRIPTION "A library for handling zip archives"
PURPOSE "Optional for zip archives.")
find_package(SharedMimeInfo QUIET)
set_package_properties(SharedMimeInfo PROPERTIES
TYPE OPTIONAL
PURPOSE "Required for archive formats without an official mimetype.")
option(WITH_TEST_COVERAGE "Build with test coverage support" OFF)
if (WITH_TEST_COVERAGE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage")
......
......@@ -75,8 +75,3 @@ install(TARGETS kerfuffle ${KDE_INSTALL_TARGETS_DEFAULT_ARGS} LIBRARY NAMELINK_S
install(FILES kerfufflePlugin.desktop DESTINATION ${KDE_INSTALL_KSERVICETYPES5DIR})
install(FILES ark.kcfg DESTINATION ${KDE_INSTALL_KCFGDIR})
install(FILES mime/kerfuffle.xml DESTINATION ${KDE_INSTALL_MIMEDIR})
if(SharedMimeInfo_FOUND)
update_xdg_mimetypes(${KDE_INSTALL_MIMEDIR})
endif()
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
<mime-type type="application/x-zstd-compressed-tar">
<comment>Tar archive (zstd-compressed)</comment>
<glob pattern="*.tar.zst"/>
</mime-type>
</mime-info>
include_directories(${LibArchive_INCLUDE_DIRS})
if(NOT LibArchive_VERSION VERSION_LESS "3.3.3")
set(ENABLE_ZSTD_SUPPORT ON BOOL)
endif()
########### 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_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(ENABLE_ZSTD_SUPPORT)
set(SUPPORTED_LIBARCHIVE_READWRITE_MIMETYPES "${SUPPORTED_LIBARCHIVE_READWRITE_MIMETYPES}application/x-zstd-compressed-tar;")
endif()
set(SUPPORTED_LIBARCHIVE_READWRITE_MIMETYPES "${SUPPORTED_LIBARCHIVE_READWRITE_MIMETYPES}application/x-zstd-compressed-tar;")
set(INSTALLED_LIBARCHIVE_PLUGINS "")
......@@ -55,13 +48,8 @@ set(SUPPORTED_READWRITE_MIMETYPES
\"application/x-lzip-compressed-tar\",
\"application/x-tzo\",
\"application/x-lrzip-compressed-tar\",
\"application/x-lz4-compressed-tar")
if(ENABLE_ZSTD_SUPPORT)
set(SUPPORTED_READWRITE_MIMETYPES
"${SUPPORTED_READWRITE_MIMETYPES}\",
\"application/x-zstd-compressed-tar")
endif()
\"application/x-lz4-compressed-tar\",
\"application/x-zstd-compressed-tar")
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/kerfuffle_libarchive_readonly.json.cmake
......@@ -74,10 +62,6 @@ configure_file(
kerfuffle_add_plugin(kerfuffle_libarchive_readonly ${kerfuffle_libarchive_readonly_SRCS})
kerfuffle_add_plugin(kerfuffle_libarchive ${kerfuffle_libarchive_readwrite_SRCS})
if(ENABLE_ZSTD_SUPPORT)
target_compile_definitions(kerfuffle_libarchive PRIVATE -DHAVE_ZSTD_SUPPORT)
endif()
target_link_libraries(kerfuffle_libarchive_readonly ${LibArchive_LIBRARIES})
target_link_libraries(kerfuffle_libarchive ${LibArchive_LIBRARIES})
......
......@@ -290,11 +290,9 @@ bool ReadWriteLibarchivePlugin::initializeWriterFilters()
case ARCHIVE_FILTER_LZ4:
ret = archive_write_add_filter_lz4(m_archiveWriter.data());
break;
#ifdef HAVE_ZSTD_SUPPORT
case ARCHIVE_FILTER_ZSTD:
ret = archive_write_add_filter_zstd(m_archiveWriter.data());
break;
#endif
case ARCHIVE_FILTER_NONE:
ret = archive_write_add_filter_none(m_archiveWriter.data());
break;
......@@ -347,11 +345,9 @@ bool ReadWriteLibarchivePlugin::initializeNewFileWriterFilters(const Compression
} 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());
#ifdef HAVE_ZSTD_SUPPORT
} else if (filename().right(3).toUpper() == QLatin1String("ZST")) {
qCDebug(ARK) << "Detected zstd compression for new file";
ret = archive_write_add_filter_zstd(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());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment