From 7dbc05515b44bf54d2a42b4da9d1e1f910868b86 Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Tue, 27 Jul 2021 01:54:30 +0200 Subject: [PATCH] [zlib] Add cmake wrapper (#18914) * Format manifest * Add cmake wrapper * x-add-version * Always use vcpkg zlib for sentry native * x-add-version * Fix and simplify wrapper * Update git-tree --- ports/sentry-native/portfile.cmake | 2 ++ ports/sentry-native/use-zlib-target.patch | 12 ++++++++++++ ports/sentry-native/vcpkg.json | 4 +++- ports/zlib/CONTROL | 5 ----- ports/zlib/portfile.cmake | 1 + ports/zlib/vcpkg-cmake-wrapper.cmake | 13 +++++++++++++ ports/zlib/vcpkg.json | 7 +++++++ versions/baseline.json | 4 ++-- versions/s-/sentry-native.json | 5 +++++ versions/z-/zlib.json | 5 +++++ 10 files changed, 50 insertions(+), 8 deletions(-) create mode 100644 ports/sentry-native/use-zlib-target.patch delete mode 100644 ports/zlib/CONTROL create mode 100644 ports/zlib/vcpkg-cmake-wrapper.cmake create mode 100644 ports/zlib/vcpkg.json diff --git a/ports/sentry-native/portfile.cmake b/ports/sentry-native/portfile.cmake index 7fac38cf57..80f745bb61 100644 --- a/ports/sentry-native/portfile.cmake +++ b/ports/sentry-native/portfile.cmake @@ -16,6 +16,7 @@ vcpkg_extract_source_archive_ex( fix-warningC5105.patch fix-config-cmake.patch fix-libcurl.patch + use-zlib-target.patch ) if (NOT DEFINED SENTRY_BACKEND) @@ -37,6 +38,7 @@ vcpkg_configure_cmake( -DSENTRY_BUILD_TESTS=OFF -DSENTRY_BUILD_EXAMPLES=OFF -DSENTRY_BACKEND=${SENTRY_BACKEND} + -DCRASHPAD_ZLIB_SYSTEM=ON ) vcpkg_install_cmake() diff --git a/ports/sentry-native/use-zlib-target.patch b/ports/sentry-native/use-zlib-target.patch new file mode 100644 index 0000000000..d4b3dfca33 --- /dev/null +++ b/ports/sentry-native/use-zlib-target.patch @@ -0,0 +1,12 @@ +diff --git a/external/crashpad/CMakeLists.txt b/external/crashpad/CMakeLists.txt +index abb0697..a57ff04 100644 +--- a/external/crashpad/CMakeLists.txt ++++ b/external/crashpad/CMakeLists.txt +@@ -22,6 +22,7 @@ option(CRASHPAD_ZLIB_SYSTEM "Use system zlib library" "${CRASHPAD_ZLIB_SYSTEM_DE + + if(CRASHPAD_ZLIB_SYSTEM) + find_package(ZLIB REQUIRED) ++ set(ZLIB_LIBRARIES ZLIB::ZLIB) + endif() + + if(LINUX OR ANDROID) diff --git a/ports/sentry-native/vcpkg.json b/ports/sentry-native/vcpkg.json index afbe40dc8f..b60162f8c7 100644 --- a/ports/sentry-native/vcpkg.json +++ b/ports/sentry-native/vcpkg.json @@ -1,6 +1,7 @@ { "name": "sentry-native", "version-semver": "0.4.11", + "port-version": 1, "description": "Sentry SDK for C, C++ and native applications.", "homepage": "https://sentry.io/", "supports": "!(arm | (arm64 & !osx) | uwp)", @@ -8,6 +9,7 @@ { "name": "curl", "platform": "!windows" - } + }, + "zlib" ] } diff --git a/ports/zlib/CONTROL b/ports/zlib/CONTROL deleted file mode 100644 index a4c1a55d69..0000000000 --- a/ports/zlib/CONTROL +++ /dev/null @@ -1,5 +0,0 @@ -Source: zlib -Version: 1.2.11 -Port-Version: 10 -Homepage: https://www.zlib.net/ -Description: A compression library diff --git a/ports/zlib/portfile.cmake b/ports/zlib/portfile.cmake index 429d85440d..572eb09072 100644 --- a/ports/zlib/portfile.cmake +++ b/ports/zlib/portfile.cmake @@ -31,6 +31,7 @@ vcpkg_configure_cmake( ) vcpkg_install_cmake() +file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}) # Install the pkgconfig file if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") diff --git a/ports/zlib/vcpkg-cmake-wrapper.cmake b/ports/zlib/vcpkg-cmake-wrapper.cmake new file mode 100644 index 0000000000..5060c55025 --- /dev/null +++ b/ports/zlib/vcpkg-cmake-wrapper.cmake @@ -0,0 +1,13 @@ +set(ZLIB_ROOT "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}") +find_path(ZLIB_INCLUDE_DIR NAMES zlib.h PATHS "${ZLIB_ROOT}/include" NO_DEFAULT_PATH) +find_library(ZLIB_LIBRARY_RELEASE NAMES zlib z PATHS "${ZLIB_ROOT}/lib" NO_DEFAULT_PATH) +find_library(ZLIB_LIBRARY_DEBUG NAMES zlibd z PATHS "${ZLIB_ROOT}/debug/lib" NO_DEFAULT_PATH) +if(NOT ZLIB_INCLUDE_DIR OR NOT ZLIB_LIBRARY_RELEASE OR (NOT ZLIB_LIBRARY_DEBUG AND EXISTS "${ZLIB_ROOT}/debug/lib")) + message("Broken installation of vcpkg port zlib") +endif() +if(CMAKE_VERSION VERSION_LESS 3.4) + include(SelectLibraryConfigurations) + select_library_configurations(ZLIB) + unset(ZLIB_FOUND) +endif() +_find_package(${ARGS}) diff --git a/ports/zlib/vcpkg.json b/ports/zlib/vcpkg.json new file mode 100644 index 0000000000..39457efec8 --- /dev/null +++ b/ports/zlib/vcpkg.json @@ -0,0 +1,7 @@ +{ + "name": "zlib", + "version-string": "1.2.11", + "port-version": 11, + "description": "A compression library", + "homepage": "https://www.zlib.net/" +} diff --git a/versions/baseline.json b/versions/baseline.json index 559b59b85e..2b77f92ecb 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -5762,7 +5762,7 @@ }, "sentry-native": { "baseline": "0.4.11", - "port-version": 0 + "port-version": 1 }, "septag-sx": { "baseline": "2019-05-07-2", @@ -6894,7 +6894,7 @@ }, "zlib": { "baseline": "1.2.11", - "port-version": 10 + "port-version": 11 }, "zlib-ng": { "baseline": "2.0.3", diff --git a/versions/s-/sentry-native.json b/versions/s-/sentry-native.json index 1d4503503a..b30921c343 100644 --- a/versions/s-/sentry-native.json +++ b/versions/s-/sentry-native.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "a2864f84fc6ef423bcc641b64b75cc574df99b85", + "version-semver": "0.4.11", + "port-version": 1 + }, { "git-tree": "8343307e093e40faaf7e894be6aed4f60cb327d0", "version-semver": "0.4.11", diff --git a/versions/z-/zlib.json b/versions/z-/zlib.json index 8b80a1711a..050e1de28b 100644 --- a/versions/z-/zlib.json +++ b/versions/z-/zlib.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "ad5b59cd3722af26f09921297562dfc76c83dbf8", + "version-string": "1.2.11", + "port-version": 11 + }, { "git-tree": "53a4615c8bb9b98a3864b834a6bbe51cc6c849ef", "version-string": "1.2.11",