From bf559d51ec103b1267ba61798f230f8cca413adb Mon Sep 17 00:00:00 2001 From: codicodi Date: Fri, 30 Dec 2016 13:31:33 +0100 Subject: add lz4 --- ports/lz4/CMakeLists.txt | 26 ++++++++++++++++++++++++++ ports/lz4/CONTROL | 3 +++ ports/lz4/auto-define-import-macro.patch | 28 ++++++++++++++++++++++++++++ ports/lz4/portfile.cmake | 29 +++++++++++++++++++++++++++++ 4 files changed, 86 insertions(+) create mode 100644 ports/lz4/CMakeLists.txt create mode 100644 ports/lz4/CONTROL create mode 100644 ports/lz4/auto-define-import-macro.patch create mode 100644 ports/lz4/portfile.cmake diff --git a/ports/lz4/CMakeLists.txt b/ports/lz4/CMakeLists.txt new file mode 100644 index 000000000..a5366f5ab --- /dev/null +++ b/ports/lz4/CMakeLists.txt @@ -0,0 +1,26 @@ +cmake_minimum_required(VERSION 3.0) +project(lz4) + +if(BUILD_SHARED_LIBS) + add_definitions(-DLZ4_DLL_EXPORT) +endif() +add_definitions(-DXXH_NAMESPACE=LZ4_) + +add_library(lz4 + lib/lz4.c + lib/lz4frame.c + lib/lz4hc.c + lib/xxhash.c) + +install(TARGETS lz4 + RUNTIME DESTINATION bin + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib) + +if(NOT LZ4_SKIP_INCLUDES) + install(FILES + lib/lz4.h + lib/lz4frame.h + lib/lz4hc.h + DESTINATION include) +endif() diff --git a/ports/lz4/CONTROL b/ports/lz4/CONTROL new file mode 100644 index 000000000..90be24a5b --- /dev/null +++ b/ports/lz4/CONTROL @@ -0,0 +1,3 @@ +Source: lz4 +Version: 1.7.4.2 +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 new file mode 100644 index 000000000..48b4585ea --- /dev/null +++ b/ports/lz4/auto-define-import-macro.patch @@ -0,0 +1,28 @@ +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 new file mode 100644 index 000000000..9e2153e4b --- /dev/null +++ b/ports/lz4/portfile.cmake @@ -0,0 +1,29 @@ + +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/lz4-1.7.4.2) +vcpkg_download_distfile(ARCHIVE + URLS "https://github.com/lz4/lz4/archive/v1.7.4.2.zip" + FILENAME "lz4-1.7.4.2.zip" + SHA512 c9a65031225ccda43ad4c7622e9f36762c18e58b4aaf43b1a33f219186fb55c43ca354f574a1591188db39f57631351b1b90f96e0c150e28de08dcb65c6759d0) + +vcpkg_extract_source_archive(${ARCHIVE}) + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + OPTIONS_DEBUG + -DLZ4_SKIP_INCLUDES=ON) + +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() + +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) -- cgit v1.2.3