aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/sentry-native
diff options
context:
space:
mode:
Diffstat (limited to 'vcpkg/ports/sentry-native')
-rw-r--r--vcpkg/ports/sentry-native/fix-cmake4.patch22
-rw-r--r--vcpkg/ports/sentry-native/fix-crashpad-wer.patch77
-rw-r--r--vcpkg/ports/sentry-native/fix-usage-runtime.patch13
-rw-r--r--vcpkg/ports/sentry-native/portfile.cmake70
-rw-r--r--vcpkg/ports/sentry-native/usage4
-rw-r--r--vcpkg/ports/sentry-native/vcpkg.json94
6 files changed, 280 insertions, 0 deletions
diff --git a/vcpkg/ports/sentry-native/fix-cmake4.patch b/vcpkg/ports/sentry-native/fix-cmake4.patch
new file mode 100644
index 0000000..b68d773
--- /dev/null
+++ b/vcpkg/ports/sentry-native/fix-cmake4.patch
@@ -0,0 +1,22 @@
+diff --git a/external/crashpad/util/CMakeLists.txt b/external/crashpad/util/CMakeLists.txt
+index f60da7d..b512fc8 100644
+--- a/external/crashpad/util/CMakeLists.txt
++++ b/external/crashpad/util/CMakeLists.txt
+@@ -428,7 +428,7 @@ if(APPLE)
+ )
+ endif()
+ foreach(x ${def_relative_files})
+- set(full_path "${CMAKE_OSX_SYSROOT}/usr/include/mach/${x}")
++ set(full_path "${_CMAKE_OSX_SYSROOT_PATH}/usr/include/mach/${x}")
+ if(NOT EXISTS "${full_path}")
+ message(FATAL_ERROR "File not found: ${full_path}")
+ endif()
+@@ -460,7 +460,7 @@ if(APPLE)
+ list(TRANSFORM includes PREPEND "--include=")
+
+ if(CMAKE_OSX_SYSROOT)
+- set(sdk --sdk ${CMAKE_OSX_SYSROOT})
++ set(sdk --sdk ${_CMAKE_OSX_SYSROOT_PATH})
+ endif()
+
+ # When building for Xcode, the `CMAKE_OSX_SYSROOT` is not set to a proper
diff --git a/vcpkg/ports/sentry-native/fix-crashpad-wer.patch b/vcpkg/ports/sentry-native/fix-crashpad-wer.patch
new file mode 100644
index 0000000..78b92e7
--- /dev/null
+++ b/vcpkg/ports/sentry-native/fix-crashpad-wer.patch
@@ -0,0 +1,77 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 2873b3d..7ee1d78 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -616,7 +616,7 @@ if(SENTRY_BACKEND_CRASHPAD)
+ endif()
+ add_subdirectory(external/crashpad crashpad_build)
+
+- if(WIN32)
++ if(WIN32 AND SENTRY_TRANSPORT_CRASHPAD_USE_WER)
+ add_dependencies(sentry crashpad::wer)
+ endif()
+
+@@ -632,7 +632,9 @@ if(SENTRY_BACKEND_CRASHPAD)
+ set_property(TARGET crashpad_snapshot PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
+ set_property(TARGET crashpad_tools PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
+ set_property(TARGET crashpad_util PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
++if(SENTRY_TRANSPORT_CRASHPAD_USE_WER)
+ set_property(TARGET crashpad_wer PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
++endif()
+ set_property(TARGET crashpad_zlib PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
+ set_property(TARGET mini_chromium PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
+ endif()
+@@ -648,7 +650,9 @@ if(SENTRY_BACKEND_CRASHPAD)
+ set_target_properties(crashpad_snapshot PROPERTIES FOLDER ${SENTRY_FOLDER})
+ set_target_properties(crashpad_tools PROPERTIES FOLDER ${SENTRY_FOLDER})
+ set_target_properties(crashpad_util PROPERTIES FOLDER ${SENTRY_FOLDER})
++if(SENTRY_TRANSPORT_CRASHPAD_USE_WER)
+ set_target_properties(crashpad_wer PROPERTIES FOLDER ${SENTRY_FOLDER})
++endif()
+ set_target_properties(crashpad_zlib PROPERTIES FOLDER ${SENTRY_FOLDER})
+ set_target_properties(mini_chromium PROPERTIES FOLDER ${SENTRY_FOLDER})
+ endif()
+@@ -660,7 +664,7 @@ if(SENTRY_BACKEND_CRASHPAD)
+ install(EXPORT crashpad_export NAMESPACE sentry_crashpad:: FILE sentry_crashpad-targets.cmake
+ DESTINATION "${CMAKE_INSTALL_CMAKEDIR}"
+ )
+- if(WIN32 AND MSVC)
++ if(WIN32 AND MSVC AND SENTRY_TRANSPORT_CRASHPAD_USE_WER)
+ sentry_install(FILES $<TARGET_PDB_FILE:crashpad_handler>
+ DESTINATION "${CMAKE_INSTALL_BINDIR}" OPTIONAL)
+ sentry_install(FILES $<TARGET_PDB_FILE:crashpad_wer>
+diff --git a/external/crashpad/handler/CMakeLists.txt b/external/crashpad/handler/CMakeLists.txt
+index 2247e2a..b89c570 100644
+--- a/external/crashpad/handler/CMakeLists.txt
++++ b/external/crashpad/handler/CMakeLists.txt
+@@ -126,7 +126,7 @@ if(NOT IOS)
+ )
+ endif()
+
+-if (WIN32)
++if (WIN32 AND SENTRY_TRANSPORT_CRASHPAD_USE_WER)
+ add_library(crashpad_wer SHARED
+ win/wer/crashpad_wer.cc
+ win/wer/crashpad_wer.h
+diff --git a/src/backends/sentry_backend_crashpad.cpp b/src/backends/sentry_backend_crashpad.cpp
+index 9ddca42..4fa1e4e 100644
+--- a/src/backends/sentry_backend_crashpad.cpp
++++ b/src/backends/sentry_backend_crashpad.cpp
+@@ -142,7 +142,7 @@ crashpad_backend_user_consent_changed(sentry_backend_t *backend)
+ data->db->GetSettings()->SetUploadsEnabled(!sentry__should_skip_upload());
+ }
+
+-#ifdef SENTRY_PLATFORM_WINDOWS
++#if defined(SENTRY_PLATFORM_WINDOWS) && defined(SENTRY_TRANSPORT_CRASHPAD_USE_WER)
+ static void
+ crashpad_register_wer_module(
+ const sentry_path_t *absolute_handler_path, const crashpad_state_t *data)
+@@ -545,7 +545,7 @@ crashpad_backend_startup(
+ options->crashpad_wait_for_upload, crash_reporter, crash_envelope);
+ sentry_free(minidump_url);
+
+-#ifdef SENTRY_PLATFORM_WINDOWS
++#if defined(SENTRY_PLATFORM_WINDOWS) && defined(SENTRY_TRANSPORT_CRASHPAD_USE_WER)
+ crashpad_register_wer_module(absolute_handler_path, data);
+ #endif
+
diff --git a/vcpkg/ports/sentry-native/fix-usage-runtime.patch b/vcpkg/ports/sentry-native/fix-usage-runtime.patch
new file mode 100644
index 0000000..3b65c48
--- /dev/null
+++ b/vcpkg/ports/sentry-native/fix-usage-runtime.patch
@@ -0,0 +1,13 @@
+diff --git a/external/crashpad/handler/CMakeLists.txt b/external/crashpad/handler/CMakeLists.txt
+index b89c570..2e0aaa1 100644
+--- a/external/crashpad/handler/CMakeLists.txt
++++ b/external/crashpad/handler/CMakeLists.txt
+@@ -88,7 +88,7 @@ if(NOT IOS)
+ $<$<COMPILE_LANGUAGE:CXX>:-Wno-ignored-attributes>
+ )
+ endif()
+- if(LINUX)
++ if(LINUX AND BUILD_SHARED_LIBS)
+ target_sources(crashpad_handler PRIVATE
+ ../client/pthread_create_linux.cc
+ )
diff --git a/vcpkg/ports/sentry-native/portfile.cmake b/vcpkg/ports/sentry-native/portfile.cmake
new file mode 100644
index 0000000..d09d1b8
--- /dev/null
+++ b/vcpkg/ports/sentry-native/portfile.cmake
@@ -0,0 +1,70 @@
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://github.com/getsentry/sentry-native/releases/download/${VERSION}/sentry-native.zip"
+ FILENAME "sentry-native-${VERSION}.zip"
+ SHA512 4a4d5adb2775dc36e32b6f07fb8ece6cd865bc027b6b49fa949cf2b37076b38d8f0ff9484c3f238a34a2a8b3c4f2bbf0391704881beb9262ed5927f75f51508e
+)
+
+vcpkg_extract_source_archive(
+ SOURCE_PATH
+ ARCHIVE "${ARCHIVE}"
+ NO_REMOVE_ONE_LEVEL
+ PATCHES
+ fix-crashpad-wer.patch
+ fix-usage-runtime.patch
+ fix-cmake4.patch
+)
+file(REMOVE_RECURSE "${SOURCE_PATH}/external/crashpad/third_party/zlib/zlib")
+
+vcpkg_list(SET options)
+
+if(NOT "backend" IN_LIST FEATURES)
+ vcpkg_list(APPEND options "-DSENTRY_BACKEND=none")
+elseif("wer" IN_LIST FEATURES)
+ vcpkg_list(APPEND options "-DSENTRY_BACKEND=crashpad")
+elseif(DEFINED SENTRY_BACKEND)
+ # Legacy, possible override from triplet, but cannot handle dependencies
+ vcpkg_list(APPEND options "-DSENTRY_BACKEND=${SENTRY_BACKEND}")
+endif()
+
+if(NOT "transport" IN_LIST FEATURES)
+ vcpkg_list(APPEND options "-DSENTRY_TRANSPORT=none")
+endif()
+
+if("wer" IN_LIST FEATURES)
+ vcpkg_list(APPEND options "-DSENTRY_TRANSPORT_CRASHPAD_USE_WER=ON")
+endif()
+
+if("compression" IN_LIST FEATURES)
+ vcpkg_list(APPEND options "-DSENTRY_TRANSPORT_COMPRESSION=ON")
+endif()
+
+if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
+ set(VCPKG_CXX_FLAGS "/D_CRT_DECLARE_NONSTDC_NAMES ${VCPKG_CXX_FLAGS}")
+ set(VCPKG_C_FLAGS "/D_CRT_DECLARE_NONSTDC_NAMES ${VCPKG_C_FLAGS}")
+endif()
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS
+ ${options}
+ -DSENTRY_BUILD_TESTS=OFF
+ -DSENTRY_BUILD_EXAMPLES=OFF
+ -DCRASHPAD_ZLIB_SYSTEM=ON
+ MAYBE_UNUSED_VARIABLES
+ CRASHPAD_ZLIB_SYSTEM
+)
+
+vcpkg_cmake_install()
+
+vcpkg_copy_pdbs()
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+
+vcpkg_cmake_config_fixup(PACKAGE_NAME sentry CONFIG_PATH lib/cmake/sentry)
+
+if(EXISTS "${CURRENT_PACKAGES_DIR}/bin/crashpad_handler${VCPKG_TARGET_EXECUTABLE_SUFFIX}")
+ vcpkg_copy_tools(TOOL_NAMES crashpad_handler AUTO_CLEAN)
+endif()
+
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
+file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
diff --git a/vcpkg/ports/sentry-native/usage b/vcpkg/ports/sentry-native/usage
new file mode 100644
index 0000000..ae06e46
--- /dev/null
+++ b/vcpkg/ports/sentry-native/usage
@@ -0,0 +1,4 @@
+sentry-native provides CMake targets:
+
+ find_package(sentry CONFIG REQUIRED)
+ target_link_libraries(main PRIVATE sentry::sentry)
diff --git a/vcpkg/ports/sentry-native/vcpkg.json b/vcpkg/ports/sentry-native/vcpkg.json
new file mode 100644
index 0000000..008ed3c
--- /dev/null
+++ b/vcpkg/ports/sentry-native/vcpkg.json
@@ -0,0 +1,94 @@
+{
+ "name": "sentry-native",
+ "version": "0.12.1",
+ "description": "Sentry SDK for C, C++ and native applications.",
+ "homepage": "https://sentry.io/",
+ "license": "MIT",
+ "supports": "osx | linux | (!arm & !uwp)",
+ "dependencies": [
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ],
+ "default-features": [
+ "backend",
+ "transport",
+ {
+ "name": "wer",
+ "platform": "windows & !static"
+ }
+ ],
+ "features": {
+ "backend": {
+ "description": [
+ "Enables the platform-specific backend.",
+ "This feature does nothing for some platforms.",
+ "Cf. https://github.com/getsentry/sentry-native#compile-time-options"
+ ],
+ "dependencies": [
+ {
+ "$comment": "pkgcong is used by the breakpad backend.",
+ "name": "pkgconf",
+ "host": true,
+ "platform": "!android & !ios"
+ },
+ {
+ "$comment": "sentry-native[transport] is used by the crashpad backend.",
+ "name": "sentry-native",
+ "features": [
+ "transport"
+ ],
+ "platform": "!android & !ios & !windows"
+ },
+ {
+ "$comment": "zlib is used by the crashpad backend.",
+ "name": "zlib",
+ "platform": "!android & !ios"
+ }
+ ]
+ },
+ "compression": {
+ "description": [
+ "Enables gzip compression support for the transport.",
+ "Cf.https://github.com/getsentry/sentry-native#compile-time-options"
+ ],
+ "dependencies": [
+ "zlib"
+ ]
+ },
+ "transport": {
+ "description": [
+ "Enables the platform-specific network transport.",
+ "This feature does nothing for some platforms.",
+ "Cf. https://github.com/getsentry/sentry-native#compile-time-options"
+ ],
+ "dependencies": [
+ {
+ "name": "curl",
+ "default-features": false,
+ "platform": "!windows"
+ }
+ ]
+ },
+ "wer": {
+ "description": [
+ "Enables the Windows Error Reporting backend.",
+ "Cf.https://github.com/getsentry/sentry-native#compile-time-options"
+ ],
+ "supports": "windows & !static",
+ "dependencies": [
+ {
+ "name": "sentry-native",
+ "features": [
+ "backend"
+ ]
+ }
+ ]
+ }
+ }
+}