From f04a4aee91babba8f9924f859bfd959fe34c2445 Mon Sep 17 00:00:00 2001 From: Tobias Kohlbau Date: Tue, 23 Jan 2018 17:23:45 +0100 Subject: [PATCH] [libzip] bump to 1.4.0 Signed-off-by: Tobias Kohlbau --- ports/libzip/CONTROL | 2 +- .../cmake_dont_build_more_than_needed.patch | 19 +++++ ports/libzip/enable-static.patch | 77 ------------------- ports/libzip/fix-attribute.patch | 12 +++ ports/libzip/portfile.cmake | 31 +++----- 5 files changed, 44 insertions(+), 97 deletions(-) create mode 100644 ports/libzip/cmake_dont_build_more_than_needed.patch delete mode 100644 ports/libzip/enable-static.patch create mode 100644 ports/libzip/fix-attribute.patch diff --git a/ports/libzip/CONTROL b/ports/libzip/CONTROL index 3ca61d39b..763275196 100644 --- a/ports/libzip/CONTROL +++ b/ports/libzip/CONTROL @@ -1,4 +1,4 @@ Source: libzip -Version: 1.3.2 +Version: 1.4.0 Build-Depends: zlib Description: A library for reading, creating, and modifying zip archives. diff --git a/ports/libzip/cmake_dont_build_more_than_needed.patch b/ports/libzip/cmake_dont_build_more_than_needed.patch new file mode 100644 index 000000000..bb0af9749 --- /dev/null +++ b/ports/libzip/cmake_dont_build_more_than_needed.patch @@ -0,0 +1,19 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 69cdb8b..4c985fb 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -149,10 +149,10 @@ ENABLE_TESTING() + + # Targets + ADD_SUBDIRECTORY(lib) +-ADD_SUBDIRECTORY(man) +-ADD_SUBDIRECTORY(src) +-ADD_SUBDIRECTORY(regress) +-ADD_SUBDIRECTORY(examples) ++#ADD_SUBDIRECTORY(man) ++#ADD_SUBDIRECTORY(src) ++#ADD_SUBDIRECTORY(regress) ++#ADD_SUBDIRECTORY(examples) + + # pkgconfig file + SET(prefix ${CMAKE_INSTALL_PREFIX}) diff --git a/ports/libzip/enable-static.patch b/ports/libzip/enable-static.patch deleted file mode 100644 index 61c93b435..000000000 --- a/ports/libzip/enable-static.patch +++ /dev/null @@ -1,77 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index deceb65..1283013 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -113,6 +113,15 @@ ADD_DEFINITIONS("-D_CRT_SECURE_NO_WARNINGS") - ADD_DEFINITIONS("-D_CRT_NONSTDC_NO_DEPRECATE") - ENDIF(MSVC) - -+OPTION(ENABLE_STATIC "Enable static builds" OFF) -+IF(ENABLE_STATIC) -+ set(BUILD_SHARED_LIBS OFF) -+ set(ZIP_EXTERN_OVERRIDE ON) -+ set(ZIP_EXTERN ON) -+ELSE(ENABLE_STATIC) -+ set(BUILD_SHARED_LIBS ON) -+ENDIF(ENABLE_STATIC) -+ - ADD_DEFINITIONS("-DHAVE_CONFIG_H") - - # rpath handling: use rpath in installed binaries -@@ -121,10 +130,10 @@ SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) - - # Targets - ADD_SUBDIRECTORY(lib) --ADD_SUBDIRECTORY(man) --ADD_SUBDIRECTORY(src) --ADD_SUBDIRECTORY(regress) --ADD_SUBDIRECTORY(examples) -+# ADD_SUBDIRECTORY(man) -+# ADD_SUBDIRECTORY(src) -+# ADD_SUBDIRECTORY(regress) -+# ADD_SUBDIRECTORY(examples) - - # pkgconfig file - SET(prefix ${CMAKE_INSTALL_PREFIX}) -diff --git a/cmake-config.h.in b/cmake-config.h.in -index 0d1839c..dd450ff 100644 ---- a/cmake-config.h.in -+++ b/cmake-config.h.in -@@ -60,7 +60,7 @@ - #cmakedefine WORDS_BIGENDIAN - /* END DEFINES */ - #define PACKAGE "@PACKAGE@" --#define VERSION "@VERSION@" -+#define LIBZIP_VERSION "@VERSION@" - - #ifndef HAVE_SSIZE_T_LIBZIP - # if SIZE_T_LIBZIP == INT_LIBZIP -diff --git a/cmake-zipconf.h.in b/cmake-zipconf.h.in -index 6a276f6..410c898 100644 ---- a/cmake-zipconf.h.in -+++ b/cmake-zipconf.h.in -@@ -118,4 +118,10 @@ typedef unsigned long long zip_uint64_t; - #define ZIP_INT64_MAX 0x7fffffffffffffffLL - #define ZIP_UINT64_MAX 0xffffffffffffffffULL - -+#cmakedefine ZIP_EXTERN_OVERRIDE -+#ifdef ZIP_EXTERN_OVERRIDE -+#undef ZIP_EXTERN -+#cmakedefine ZIP_EXTERN -+#endif -+ - #endif /* zipconf.h */ -diff --git a/lib/compat.h b/lib/compat.h -index 625c84e..8943587 100644 ---- a/lib/compat.h -+++ b/lib/compat.h -@@ -42,7 +42,9 @@ - #define __STDC_LIMIT_MACROS - - #ifdef _WIN32 -+#ifndef ZIP_EXTERN_OVERRIDE - #define ZIP_EXTERN __declspec(dllexport) -+#endif - /* for dup(), close(), etc. */ - #include - #endif diff --git a/ports/libzip/fix-attribute.patch b/ports/libzip/fix-attribute.patch new file mode 100644 index 000000000..0669d75d6 --- /dev/null +++ b/ports/libzip/fix-attribute.patch @@ -0,0 +1,12 @@ +diff --git a/lib/zip_algorithm_bzip2.c b/lib/zip_algorithm_bzip2.c +index 1748fd4..fd74503 100644 +--- a/lib/zip_algorithm_bzip2.c ++++ b/lib/zip_algorithm_bzip2.c +@@ -270,6 +270,6 @@ zip_compression_algorithm_t zip_algorithm_bzip2_decompress = { + + #else + +-static int dummy __attribute__((used)); ++static int dummy; + + #endif /* HAVE_LIBBZ2 */ diff --git a/ports/libzip/portfile.cmake b/ports/libzip/portfile.cmake index bcde856e2..ae95a3ae4 100644 --- a/ports/libzip/portfile.cmake +++ b/ports/libzip/portfile.cmake @@ -1,34 +1,27 @@ include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libzip-1.3.2) -vcpkg_download_distfile(ARCHIVE_FILE - URLS "https://nih.at/libzip/libzip-1.3.2.tar.gz" - FILENAME "libzip-1.3.2.tar.gz" - SHA512 75b7e6f541be30e721275723f264c20f9a3be5335d954b5909acdddb0f6dd9b2420166904c9b88206692a57a4aa54e4fe8ed4d62c1f4b900aebf6ad40f767376 +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO nih-at/libzip + REF rel-1-4-0 + SHA512 3d8c5e64c567d2b91670ea041228d74cc8415116dfeb5c9bcf587ab817618eace668c5171122eeccf2a5f25242c2439c5f60b361f99a06274ab58aea720fe0bb ) -vcpkg_extract_source_archive(${ARCHIVE_FILE}) # Patch cmake and configuration to allow static builds vcpkg_apply_patches( SOURCE_PATH ${SOURCE_PATH} - PATCHES "${CMAKE_CURRENT_LIST_DIR}/enable-static.patch" + PATCHES + "${CMAKE_CURRENT_LIST_DIR}/cmake_dont_build_more_than_needed.patch" + "${CMAKE_CURRENT_LIST_DIR}/fix-attribute.patch" ) -if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) - vcpkg_configure_cmake( - SOURCE_PATH ${SOURCE_PATH} - OPTIONS -DENABLE_STATIC=OFF - ) -else() - vcpkg_configure_cmake( - SOURCE_PATH ${SOURCE_PATH} - OPTIONS -DENABLE_STATIC=ON - ) -endif() +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA +) vcpkg_install_cmake() # Move zipconf.h to include and remove include directories from lib -file(RENAME ${CURRENT_PACKAGES_DIR}/lib/libzip/include/zipconf.h ${CURRENT_PACKAGES_DIR}/include/zipconf.h) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/libzip ${CURRENT_PACKAGES_DIR}/debug/lib/libzip) # Remove debug include