From 1840f03fdf223f8a8fbcb6087d39bde98abb3ef9 Mon Sep 17 00:00:00 2001 From: SunBlack Date: Thu, 2 Mar 2023 21:07:40 +0100 Subject: [PATCH] [libdeflate] New port (#29910) --- ports/libdeflate/portfile.cmake | 37 +++++++++++++++++++ .../remove_wrong_c_flags_modification.diff | 12 ++++++ ports/libdeflate/usage | 4 ++ ports/libdeflate/vcpkg.json | 37 +++++++++++++++++++ versions/baseline.json | 3 ++ versions/l-/libdeflate.json | 9 +++++ 6 files changed, 102 insertions(+) create mode 100644 ports/libdeflate/portfile.cmake create mode 100644 ports/libdeflate/remove_wrong_c_flags_modification.diff create mode 100644 ports/libdeflate/usage create mode 100644 ports/libdeflate/vcpkg.json create mode 100644 versions/l-/libdeflate.json diff --git a/ports/libdeflate/portfile.cmake b/ports/libdeflate/portfile.cmake new file mode 100644 index 0000000000..7d852a8de4 --- /dev/null +++ b/ports/libdeflate/portfile.cmake @@ -0,0 +1,37 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO ebiggers/libdeflate + REF "v${VERSION}" + SHA512 4e2c0f78e55befc8cbc390722ee5e9e7662315eaafe1979e300972990acf4afffc32a1220cca7a6e944d551a430dd13d36b40066dfe8141789de1a5418ac620f + HEAD_REF master + PATCHES + remove_wrong_c_flags_modification.diff +) + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + compression LIBDEFLATE_COMPRESSION_SUPPORT + decompression LIBDEFLATE_DECOMPRESSION_SUPPORT + gzip LIBDEFLATE_ZLIB_SUPPORT + zlib LIBDEFLATE_GZIP_SUPPORT +) + +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" LIBDEFLATE_BUILD_STATIC) +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" LIBDEFLATE_BUILD_SHARED) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DLIBDEFLATE_BUILD_SHARED_LIB=${LIBDEFLATE_BUILD_SHARED} + -DLIBDEFLATE_BUILD_STATIC_LIB=${LIBDEFLATE_BUILD_STATIC} + -DLIBDEFLATE_BUILD_GZIP=OFF + ${FEATURE_OPTIONS} +) + +vcpkg_cmake_install() +vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/libdeflate") +vcpkg_fixup_pkgconfig() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING") +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") diff --git a/ports/libdeflate/remove_wrong_c_flags_modification.diff b/ports/libdeflate/remove_wrong_c_flags_modification.diff new file mode 100644 index 0000000000..94a125c9d9 --- /dev/null +++ b/ports/libdeflate/remove_wrong_c_flags_modification.diff @@ -0,0 +1,12 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 0acd26f..218c48b 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -61,7 +61,6 @@ if(NOT LIBDEFLATE_BUILD_STATIC_LIB) + endif() + + # Set common C compiler flags for all targets (the library and the programs). +-set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG") + set(CMAKE_C_STANDARD 99) + if(NOT MSVC) + check_c_compiler_flag(-Wdeclaration-after-statement HAVE_WDECLARATION_AFTER_STATEMENT) diff --git a/ports/libdeflate/usage b/ports/libdeflate/usage new file mode 100644 index 0000000000..0c41e9570a --- /dev/null +++ b/ports/libdeflate/usage @@ -0,0 +1,4 @@ +The package zstd provides CMake targets: + + find_package(libdeflate CONFIG REQUIRED) + target_link_libraries(main PRIVATE $,libdeflate::libdeflate_shared,libdeflate::libdeflate_static>) diff --git a/ports/libdeflate/vcpkg.json b/ports/libdeflate/vcpkg.json new file mode 100644 index 0000000000..4c0483d839 --- /dev/null +++ b/ports/libdeflate/vcpkg.json @@ -0,0 +1,37 @@ +{ + "name": "libdeflate", + "version": "1.17", + "description": "libdeflate is a library for fast, whole-buffer DEFLATE-based compression and decompression.", + "homepage": "https://github.com/ebiggers/libdeflate", + "license": "MIT", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "default-features": [ + "compression", + "decompression", + "gzip", + "zlib" + ], + "features": { + "compression": { + "description": "Support compression" + }, + "decompression": { + "description": "Support decompression" + }, + "gzip": { + "description": "Support the gzip format" + }, + "zlib": { + "description": "Support the zlib format" + } + } +} diff --git a/versions/baseline.json b/versions/baseline.json index fa0727d6de..b9813c130a 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -3824,6 +3824,9 @@ "baseline": "1.0.8", "port-version": 6 }, + "libdeflate": { + "baseline": "1.17" + }, "libdisasm": { "baseline": "0.23", "port-version": 9 diff --git a/versions/l-/libdeflate.json b/versions/l-/libdeflate.json new file mode 100644 index 0000000000..92a1afdf67 --- /dev/null +++ b/versions/l-/libdeflate.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "023c8297e1d45d680194366783974818522294bd", + "version": "1.17", + "port-version": 0 + } + ] +}