diff --git a/ports/sentry-native/fix-crashpad-wer.patch b/ports/sentry-native/fix-crashpad-wer.patch new file mode 100644 index 0000000000..17c10b8896 --- /dev/null +++ b/ports/sentry-native/fix-crashpad-wer.patch @@ -0,0 +1,77 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 2e8ffcd..81907b8 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -423,7 +423,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() + +@@ -438,7 +438,9 @@ if(SENTRY_BACKEND_CRASHPAD) + set_property(TARGET crashpad_snapshot PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + set_property(TARGET crashpad_tools PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + set_property(TARGET crashpad_util PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") ++if(SENTRY_TRANSPORT_CRASHPAD_USE_WER) + set_property(TARGET crashpad_wer PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") ++endif() + set_property(TARGET crashpad_zlib PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + set_property(TARGET mini_chromium PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + endif() +@@ -455,7 +457,9 @@ if(SENTRY_BACKEND_CRASHPAD) + set_target_properties(crashpad_util PROPERTIES FOLDER ${SENTRY_FOLDER}) + set_target_properties(crashpad_zlib PROPERTIES FOLDER ${SENTRY_FOLDER}) + set_target_properties(mini_chromium PROPERTIES FOLDER ${SENTRY_FOLDER}) ++if(SENTRY_TRANSPORT_CRASHPAD_USE_WER) + set_target_properties(crashpad_wer PROPERTIES FOLDER ${SENTRY_FOLDER}) ++endif() + endif() + + target_link_libraries(sentry PRIVATE +@@ -465,7 +469,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 $ + DESTINATION "${CMAKE_INSTALL_BINDIR}" OPTIONAL) + sentry_install(FILES $ +diff --git a/external/crashpad/handler/CMakeLists.txt b/external/crashpad/handler/CMakeLists.txt +index 55d2e4a..b1c99ae 100644 +--- a/external/crashpad/handler/CMakeLists.txt ++++ b/external/crashpad/handler/CMakeLists.txt +@@ -123,7 +123,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 711dc57..4c1d473 100644 +--- a/src/backends/sentry_backend_crashpad.cpp ++++ b/src/backends/sentry_backend_crashpad.cpp +@@ -115,7 +115,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) +@@ -413,7 +413,7 @@ crashpad_backend_startup( + return 1; + } + +-#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/ports/sentry-native/portfile.cmake b/ports/sentry-native/portfile.cmake index 3404f89d5e..31d6021f28 100644 --- a/ports/sentry-native/portfile.cmake +++ b/ports/sentry-native/portfile.cmake @@ -1,7 +1,7 @@ vcpkg_download_distfile(ARCHIVE URLS "https://github.com/getsentry/sentry-native/releases/download/${VERSION}/sentry-native.zip" FILENAME "sentry-native-${VERSION}.zip" - SHA512 745e2a4590df5412ab62ec6bb32efa7674423d4f0466f4ead9d327d6b0f9308ee8ae328b4beac00b31b34cf88d1dc0a102e81363b4a4a0395e98fcb0758c0551 + SHA512 bf6d9aef8129d9ad9b1617e03bf7ac5e4ac5572ac87546f9428a359c4fc3364d2591cc001e7a28f50509d5cfddab9a17da2d4a33e344280fd490c8fe5173f2c7 ) vcpkg_extract_source_archive( @@ -10,6 +10,7 @@ vcpkg_extract_source_archive( NO_REMOVE_ONE_LEVEL PATCHES fix-config-cmake.patch + fix-crashpad-wer.patch ) file(REMOVE_RECURSE "${SOURCE_PATH}/external/crashpad/third_party/zlib/zlib") @@ -17,6 +18,8 @@ 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}") @@ -26,6 +29,10 @@ 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(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}") @@ -55,3 +62,4 @@ if(EXISTS "${CURRENT_PACKAGES_DIR}/bin/crashpad_handler${VCPKG_TARGET_EXECUTABLE 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/ports/sentry-native/usage b/ports/sentry-native/usage new file mode 100644 index 0000000000..ae06e46f31 --- /dev/null +++ b/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/ports/sentry-native/vcpkg.json b/ports/sentry-native/vcpkg.json index ab0ef2abd7..eedebd34b7 100644 --- a/ports/sentry-native/vcpkg.json +++ b/ports/sentry-native/vcpkg.json @@ -1,7 +1,6 @@ { "name": "sentry-native", - "version": "0.7.0", - "port-version": 1, + "version": "0.7.1", "description": "Sentry SDK for C, C++ and native applications.", "homepage": "https://sentry.io/", "license": "MIT", @@ -18,7 +17,11 @@ ], "default-features": [ "backend", - "transport" + "transport", + { + "name": "wer", + "platform": "windows & !static" + } ], "features": { "backend": { @@ -54,6 +57,21 @@ "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" + ] + } + ] } } } diff --git a/versions/baseline.json b/versions/baseline.json index 0b9d709a62..1dbc72dd34 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -7961,8 +7961,8 @@ "port-version": 1 }, "sentry-native": { - "baseline": "0.7.0", - "port-version": 1 + "baseline": "0.7.1", + "port-version": 0 }, "septag-dmon": { "baseline": "2022-02-08", diff --git a/versions/s-/sentry-native.json b/versions/s-/sentry-native.json index 6798e512f8..a8b3e099cc 100644 --- a/versions/s-/sentry-native.json +++ b/versions/s-/sentry-native.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "573e6eab33f6c6e86bf574966809aba512874371", + "version": "0.7.1", + "port-version": 0 + }, { "git-tree": "3b95acbd27868522d2e27abe48d9f108d439f523", "version": "0.7.0",