endif()
include( MacroLibrary )
-list(APPEND CMAKE_MODULE_PATH ${ark_SOURCE_DIR}/cmake/modules)
macro_optional_find_package(LibArchive 3.0.3)
macro_log_feature(LIBARCHIVE_FOUND "LibArchive" "A library for dealing with a wide variety of archive file formats" "http://code.google.com/p/libarchive/" FALSE "" "Required for among others tar, tar.gz, tar.bz2 formats in Ark.")
-configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CTestCustom.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/CTestCustom.cmake)
add_definitions(-DQT_NO_CAST_FROM_ASCII)
+++ /dev/null
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-1. Redistributions of source code must retain the copyright
- notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-3. The name of the author may not be used to endorse or promote products
- derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+++ /dev/null
-# - Try to find libarchive
-# Once done this will define
-#
-# LIBARCHIVE_FOUND - system has libarchive
-# LIBARCHIVE_INCLUDE_DIR - the libarchive include directory
-# LIBARCHIVE_LIBRARY - Link this to use libarchive
-# HAVE_LIBARCHIVE_GZIP_SUPPORT - whether libarchive has been compiled with gzip support
-# HAVE_LIBARCHIVE_LZMA_SUPPORT - whether libarchive has been compiled with lzma support
-# HAVE_LIBARCHIVE_XZ_SUPPORT - whether libarchive has been compiled with xz support
-# HAVE_LIBARCHIVE_RPM_SUPPORT - whether libarchive has been compiled with rpm support
-# HAVE_LIBARCHIVE_CAB_SUPPORT - whether libarchive has been compiled with cab support
-#
-# Copyright (c) 2006, Pino Toscano, <toscano.pino@tiscali.it>
-#
-# Redistribution and use is allowed according to the terms of the BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-
-include(CheckLibraryExists)
-
-if (LIBARCHIVE_LIBRARY AND LIBARCHIVE_INCLUDE_DIR)
- # in cache already
- set(LIBARCHIVE_FOUND TRUE)
-else (LIBARCHIVE_LIBRARY AND LIBARCHIVE_INCLUDE_DIR)
- find_path(LIBARCHIVE_INCLUDE_DIR archive.h
- ${GNUWIN32_DIR}/include
- )
-
- find_library(LIBARCHIVE_LIBRARY NAMES archive libarchive archive2 libarchive2
- PATHS
- ${GNUWIN32_DIR}/lib
- )
-
- if (LIBARCHIVE_LIBRARY)
- check_library_exists(${LIBARCHIVE_LIBRARY} archive_write_add_filter_gzip "" HAVE_LIBARCHIVE_GZIP_SUPPORT)
- check_library_exists(${LIBARCHIVE_LIBRARY} archive_write_add_filter_bzip2 "" HAVE_LIBARCHIVE_BZIP2_SUPPORT)
- check_library_exists(${LIBARCHIVE_LIBRARY} archive_write_add_filter_lzma "" HAVE_LIBARCHIVE_LZMA_SUPPORT)
- check_library_exists(${LIBARCHIVE_LIBRARY} archive_write_add_filter_xz "" HAVE_LIBARCHIVE_XZ_SUPPORT)
- check_library_exists(${LIBARCHIVE_LIBRARY} archive_read_support_filter_rpm "" HAVE_LIBARCHIVE_RPM_SUPPORT)
- check_library_exists(${LIBARCHIVE_LIBRARY} archive_read_support_format_cab "" HAVE_LIBARCHIVE_CAB_SUPPORT)
- endif (LIBARCHIVE_LIBRARY)
-
- include(FindPackageHandleStandardArgs)
- find_package_handle_standard_args(LibArchive DEFAULT_MSG LIBARCHIVE_INCLUDE_DIR LIBARCHIVE_LIBRARY HAVE_LIBARCHIVE_GZIP_SUPPORT)
-
- mark_as_advanced(LIBARCHIVE_INCLUDE_DIR LIBARCHIVE_LIBRARY HAVE_LIBARCHIVE_GZIP_SUPPORT HAVE_LIBARCHIVE_LZMA_SUPPORT HAVE_LIBARCHIVE_RPM_SUPPORT HAVE_LIBARCHIVE_CAB_SUPPORT)
-endif (LIBARCHIVE_LIBRARY AND LIBARCHIVE_INCLUDE_DIR)
+++ /dev/null
-#cmakedefine HAVE_LIBARCHIVE_LZMA_SUPPORT ${HAVE_LIBARCHIVE_LZMA_SUPPORT}
-#cmakedefine HAVE_LIBARCHIVE_XZ_SUPPORT ${HAVE_LIBARCHIVE_XZ_SUPPORT}
-if (LIBARCHIVE_FOUND)
- if( NOT HAVE_LIBARCHIVE_LZMA_SUPPORT OR NOT HAVE_LIBARCHIVE_XZ_SUPPORT )
- message(STATUS "Your libarchive does not have support for lzma and/or xz archives.")
- endif( NOT HAVE_LIBARCHIVE_LZMA_SUPPORT OR NOT HAVE_LIBARCHIVE_XZ_SUPPORT )
- if( NOT HAVE_LIBARCHIVE_RPM_SUPPORT )
- message(STATUS "Your libarchive does not have support for rpm archives.")
- endif( NOT HAVE_LIBARCHIVE_RPM_SUPPORT )
- if( NOT HAVE_LIBARCHIVE_CAB_SUPPORT )
- message(STATUS "Your libarchive does not have support for cab archives.")
- endif( NOT HAVE_LIBARCHIVE_CAB_SUPPORT )
+if (LibArchive_FOUND)
add_subdirectory( libarchive )
-endif (LIBARCHIVE_FOUND)
+endif (LibArchive_FOUND)
add_subdirectory( clirarplugin )
add_subdirectory( libsinglefileplugin )
include_directories(${LIBARCHIVE_INCLUDE_DIR})
########### next target ###############
-set(SUPPORTED_LIBARCHIVE_READONLY_MIMETYPES "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_READWRITE_MIMETYPES "application/x-tar;application/x-compressed-tar;application/x-bzip-compressed-tar;application/x-tarz;application/x-xz-compressed-tar;application/x-lzma-compressed-tar;")
-if(HAVE_LIBARCHIVE_RPM_SUPPORT)
- set(SUPPORTED_LIBARCHIVE_READONLY_MIMETYPES "${SUPPORTED_LIBARCHIVE_READONLY_MIMETYPES}application/x-rpm;application/x-source-rpm;")
-endif(HAVE_LIBARCHIVE_RPM_SUPPORT)
-if(HAVE_LIBARCHIVE_CAB_SUPPORT)
- set(SUPPORTED_LIBARCHIVE_READONLY_MIMETYPES "${SUPPORTED_LIBARCHIVE_READONLY_MIMETYPES}application/vnd.ms-cab-compressed;")
-endif(HAVE_LIBARCHIVE_CAB_SUPPORT)
-
-# zip and 7z
-set(SUPPORTED_LIBARCHIVE_READWRITE_MIMETYPES "${SUPPORTED_LIBARCHIVE_READWRITE_MIMETYPES}application/x-java-archive;application/zip;")
-set(SUPPORTED_LIBARCHIVE_READWRITE_MIMETYPES "${SUPPORTED_LIBARCHIVE_READWRITE_MIMETYPES}application/x-7z-compressed;")
-
-# This MIME type was originally set in ark.desktop but is not mentioned anywhere else.
-# Assuming that, if it were supported, it would be here.
-set(SUPPORTED_LIBARCHIVE_READONLY_MIMETYPES "${SUPPORTED_LIBARCHIVE_READONLY_MIMETYPES}application/x-servicepack;")
+set(SUPPORTED_LIBARCHIVE_READONLY_MIMETYPES "application/x-deb;application/x-cd-image;application/x-bcpio;application/x-cpio;application/x-cpio-compressed;application/x-sv4cpio;application/x-sv4crc;application/x-rpm;application/x-source-rpm;application/vnd.ms-cab-compressed;application/x-servicepack;")
+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;application/x-lzma-compressed-tar;application/x-java-archive;application/zip;application/x-7z-compressed;")
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/kerfuffle_libarchive_readonly.desktop.cmake
} else if (filename().right(3).toUpper() == QLatin1String( "BZ2" )) {
kDebug() << "Detected bzip2 compression for new file";
ret = archive_write_add_filter_bzip2(arch_writer.data());
-#ifdef HAVE_LIBARCHIVE_XZ_SUPPORT
} else if (filename().right(2).toUpper() == QLatin1String( "XZ" )) {
kDebug() << "Detected xz compression for new file";
ret = archive_write_add_filter_xz(arch_writer.data());
-#endif
-#ifdef HAVE_LIBARCHIVE_LZMA_SUPPORT
} else if (filename().right(4).toUpper() == QLatin1String( "LZMA" )) {
kDebug() << "Detected lzma compression for new file";
ret = archive_write_add_filter_lzma(arch_writer.data());
-#endif
} else if (filename().right(3).toUpper() == QLatin1String( "TAR" )) {
kDebug() << "Detected no compression for new file (pure tar)";
ret = archive_write_add_filter_none(arch_writer.data());
case ARCHIVE_FILTER_BZIP2:
ret = archive_write_add_filter_bzip2(arch_writer.data());
break;
-#ifdef HAVE_LIBARCHIVE_XZ_SUPPORT
case ARCHIVE_FILTER_XZ:
ret = archive_write_add_filter_xz(arch_writer.data());
break;
-#endif
-#ifdef HAVE_LIBARCHIVE_LZMA_SUPPORT
case ARCHIVE_FILTER_LZMA:
ret = archive_write_add_filter_lzma(arch_writer.data());
break;
-#endif
case ARCHIVE_FILTER_NONE:
if (filename().right(3).toUpper() == QLatin1String( "ZIP" )) {
ret = archive_write_set_format_zip(arch_writer.data());
case ARCHIVE_FILTER_BZIP2:
ret = archive_write_add_filter_bzip2(arch_writer.data());
break;
-#ifdef HAVE_LIBARCHIVE_XZ_SUPPORT
case ARCHIVE_FILTER_XZ:
ret = archive_write_add_filter_xz(arch_writer.data());
break;
-#endif
-#ifdef HAVE_LIBARCHIVE_LZMA_SUPPORT
case ARCHIVE_FILTER_LZMA:
ret = archive_write_add_filter_lzma(arch_writer.data());
break;
-#endif
case ARCHIVE_FILTER_NONE:
if (filename().right(3).toUpper() == QLatin1String( "ZIP" )) {
ret = archive_write_set_format_zip(arch_writer.data());
{
ArchiveEntry e;
-#ifdef _MSC_VER
- e[FileName] = QDir::fromNativeSeparators(QString::fromUtf16((ushort*)archive_entry_pathname_w(aentry)));
-#else
e[FileName] = QDir::fromNativeSeparators(QString::fromWCharArray(archive_entry_pathname_w(aentry)));
-#endif
e[InternalID] = e[FileName];
const QString owner = QString::fromAscii(archive_entry_uname(aentry));