From 1b304fff8c3b2e450d244d668d2f68163bdbf0a0 Mon Sep 17 00:00:00 2001 From: codicodi Date: Fri, 18 Aug 2017 20:05:55 +0200 Subject: [PATCH] [lz4] update to 1.8.0 --- ports/lz4/CMakeLists.txt | 2 +- ports/lz4/CONTROL | 2 +- ports/lz4/auto-define-import-macro.patch | 28 ----------------------- ports/lz4/portfile.cmake | 29 ++++++++++++------------ 4 files changed, 17 insertions(+), 44 deletions(-) delete mode 100644 ports/lz4/auto-define-import-macro.patch diff --git a/ports/lz4/CMakeLists.txt b/ports/lz4/CMakeLists.txt index a5366f5ab..b082ab374 100644 --- a/ports/lz4/CMakeLists.txt +++ b/ports/lz4/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.0) -project(lz4) +project(lz4 C) if(BUILD_SHARED_LIBS) add_definitions(-DLZ4_DLL_EXPORT) diff --git a/ports/lz4/CONTROL b/ports/lz4/CONTROL index b48ba5424..c6d730c2d 100644 --- a/ports/lz4/CONTROL +++ b/ports/lz4/CONTROL @@ -1,3 +1,3 @@ Source: lz4 -Version: 1.7.5 +Version: 1.8.0 Description: Lossless compression algorithm, providing compression speed at 400 MB/s per core. diff --git a/ports/lz4/auto-define-import-macro.patch b/ports/lz4/auto-define-import-macro.patch deleted file mode 100644 index 314c228db..000000000 --- a/ports/lz4/auto-define-import-macro.patch +++ /dev/null @@ -1,28 +0,0 @@ -diff --git a/lz4.h b/lz4.h -index 7420ad8..c1c3e56 100644 ---- a/lz4.h -+++ b/lz4.h -@@ -73,6 +73,9 @@ extern "C" { - * LZ4_DLL_EXPORT : - * Enable exporting of functions when building a Windows DLL - */ -+ -+#define LZ4_DLL_IMPORT 1 -+ - #if defined(LZ4_DLL_EXPORT) && (LZ4_DLL_EXPORT==1) - # define LZ4LIB_API __declspec(dllexport) - #elif defined(LZ4_DLL_IMPORT) && (LZ4_DLL_IMPORT==1) -diff --git a/lz4frame.h b/lz4frame.h -index 3104d2e..4442461 100644 ---- a/lz4frame.h -+++ b/lz4frame.h -@@ -55,6 +55,9 @@ extern "C" { - * LZ4_DLL_EXPORT : - * Enable exporting of functions when building a Windows DLL - */ -+ -+#define LZ4_DLL_IMPORT 1 -+ - #if defined(LZ4_DLL_EXPORT) && (LZ4_DLL_EXPORT==1) - # define LZ4FLIB_API __declspec(dllexport) - #elif defined(LZ4_DLL_IMPORT) && (LZ4_DLL_IMPORT==1) diff --git a/ports/lz4/portfile.cmake b/ports/lz4/portfile.cmake index dc6f80ed9..6664c2b79 100644 --- a/ports/lz4/portfile.cmake +++ b/ports/lz4/portfile.cmake @@ -1,12 +1,10 @@ - include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/lz4-1.7.5) -vcpkg_download_distfile(ARCHIVE - URLS "https://github.com/lz4/lz4/archive/v1.7.5.zip" - FILENAME "lz4-1.7.5.zip" - SHA512 09968b67a5cd8555f6e1d95b99971a82d228c6d8d9f9dd9e9a33c9633bed9bcf1e370c2ff44e58c6ca72d103c149585b3e83061c690f3e857eb5f53d586f86a4) - -vcpkg_extract_source_archive(${ARCHIVE}) +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO lz4/lz4 + REF v1.8.0 + SHA512 aea46d4a900a3ede7dd7b498ee938ecd98397d3277c5b3a85b4236a44777cba85cd68a2f32c993b872afda96c5dafe0cb3dd391101fe8181e17c9f48884c1535 + HEAD_REF dev) file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) @@ -19,12 +17,15 @@ vcpkg_configure_cmake( vcpkg_install_cmake() vcpkg_copy_pdbs() -if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) - vcpkg_apply_patches( - SOURCE_PATH ${CURRENT_PACKAGES_DIR}/include - PATCHES - ${CMAKE_CURRENT_LIST_DIR}/auto-define-import-macro.patch) -endif() +foreach(FILE lz4.h lz4frame.h) + file(READ ${CURRENT_PACKAGES_DIR}/include/${FILE} LZ4_HEADER) + if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + string(REPLACE "defined(LZ4_DLL_IMPORT) && (LZ4_DLL_IMPORT==1)" "1" LZ4_HEADER "${LZ4_HEADER}") + else() + string(REPLACE "defined(LZ4_DLL_IMPORT) && (LZ4_DLL_IMPORT==1)" "0" LZ4_HEADER "${LZ4_HEADER}") + endif() + file(WRITE ${CURRENT_PACKAGES_DIR}/include/${FILE} "${LZ4_HEADER}") +endforeach() file(COPY ${SOURCE_PATH}/lib/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/lz4) file(RENAME ${CURRENT_PACKAGES_DIR}/share/lz4/LICENSE ${CURRENT_PACKAGES_DIR}/share/lz4/copyright)