OSDN Git Service

ark: drop libarchive cmake module and unconditionalize some features
authorIvailo Monev <xakepa10@gmail.com>
Sun, 4 Jan 2015 02:18:10 +0000 (02:18 +0000)
committerIvailo Monev <xakepa10@gmail.com>
Sun, 4 Jan 2015 02:18:10 +0000 (02:18 +0000)
since CMake 2.8.3 (according to Raphael) FindLibArchive module is
bundled with it, to avoid dublication drop the bundled one.

in addition, libarchive does not conditionally define support of
archives and will just bail out if the format is not recognized
thus dropping the ifdef's in the handler

ark/CMakeLists.txt
ark/cmake/modules/COPYING-CMAKE-SCRIPTS [deleted file]
ark/cmake/modules/FindLibArchive.cmake [deleted file]
ark/config.h.cmake [deleted file]
ark/plugins/CMakeLists.txt
ark/plugins/libarchive/CMakeLists.txt
ark/plugins/libarchive/libarchivehandler.cpp

index f2a6bed..f58370d 100644 (file)
@@ -19,12 +19,10 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
 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)
diff --git a/ark/cmake/modules/COPYING-CMAKE-SCRIPTS b/ark/cmake/modules/COPYING-CMAKE-SCRIPTS
deleted file mode 100644 (file)
index 4b41776..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-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.
diff --git a/ark/cmake/modules/FindLibArchive.cmake b/ark/cmake/modules/FindLibArchive.cmake
deleted file mode 100644 (file)
index 06b9198..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-# - 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)
diff --git a/ark/config.h.cmake b/ark/config.h.cmake
deleted file mode 100644 (file)
index 1d0b1cb..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#cmakedefine HAVE_LIBARCHIVE_LZMA_SUPPORT ${HAVE_LIBARCHIVE_LZMA_SUPPORT}
-#cmakedefine HAVE_LIBARCHIVE_XZ_SUPPORT ${HAVE_LIBARCHIVE_XZ_SUPPORT}
index b880c1e..284cae7 100644 (file)
@@ -1,15 +1,6 @@
-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 )
index 59a77e2..5bed9c2 100644 (file)
@@ -1,22 +1,8 @@
 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
index 903b294..f083840 100644 (file)
@@ -387,16 +387,12 @@ bool LibArchiveInterface::addFiles(const QStringList& files, const CompressionOp
         } 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());
@@ -425,16 +421,12 @@ bool LibArchiveInterface::addFiles(const QStringList& files, const CompressionOp
         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());
@@ -576,16 +568,12 @@ bool LibArchiveInterface::deleteFiles(const QVariantList& files)
     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());
@@ -648,11 +636,7 @@ void LibArchiveInterface::emitEntryFromArchiveEntry(struct archive_entry *aentry
 {
     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));