diff options
| author | Stefan Boberg <[email protected]> | 2025-10-27 19:35:52 +0100 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2025-10-27 19:35:52 +0100 |
| commit | 66a16ebb581985bcd80892015afd068bdf6aea21 (patch) | |
| tree | 60e0b83c903b2d1c4ef7c4dab44dd3f6fc21bcbd | |
| parent | tweaks for sentry-native build on Windows (diff) | |
| download | zen-66a16ebb581985bcd80892015afd068bdf6aea21.tar.xz zen-66a16ebb581985bcd80892015afd068bdf6aea21.zip | |
added patch for breakpad so it compiles with exceptions enabled
if we don't do this the build fails due to ODR violations at link time code generation, due to differences in `std::exception` layout
also made runtime library choice on Windows very explicit
| -rw-r--r-- | repo/packages/l/libcurl/xmake.lua | 2 | ||||
| -rw-r--r-- | repo/packages/s/sentry-native/patches/0.7.6/breakpad_exceptions.patch | 39 | ||||
| -rw-r--r-- | repo/packages/s/sentry-native/xmake.lua | 5 | ||||
| -rw-r--r-- | xmake.lua | 21 |
4 files changed, 63 insertions, 4 deletions
diff --git a/repo/packages/l/libcurl/xmake.lua b/repo/packages/l/libcurl/xmake.lua index a9dd2e686..2fc2de351 100644 --- a/repo/packages/l/libcurl/xmake.lua +++ b/repo/packages/l/libcurl/xmake.lua @@ -139,7 +139,7 @@ package("libcurl") table.insert(configs, (version:ge("7.65") and "-DCURL_USE_SECTRANSP=ON" or "-DCMAKE_USE_DARWINSSL=ON")) end if package:is_plat("windows") then - table.insert(configs, "-DCURL_STATIC_CRT=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF")) + table.insert(configs, "-DCURL_STATIC_CRT=" .. (package:runtimes():startswith("MT") and "ON" or "OFF")) end if package:is_plat("mingw") and version:le("7.85.0") then io.replace("src/CMakeLists.txt", 'COMMAND ${CMAKE_COMMAND} -E echo "/* built-in manual is disabled, blank function */" > tool_hugehelp.c', "", {plain = true}) diff --git a/repo/packages/s/sentry-native/patches/0.7.6/breakpad_exceptions.patch b/repo/packages/s/sentry-native/patches/0.7.6/breakpad_exceptions.patch new file mode 100644 index 000000000..86aa79d86 --- /dev/null +++ b/repo/packages/s/sentry-native/patches/0.7.6/breakpad_exceptions.patch @@ -0,0 +1,39 @@ +diff --git a/external/crashpad/CMakeLists.txt b/external/crashpad/CMakeLists.txt +index c113b4ab..a9c29b6b 100644 +--- a/external/crashpad/CMakeLists.txt ++++ b/external/crashpad/CMakeLists.txt +@@ -104,7 +104,6 @@ if(WIN32) + UNICODE + WIN32_LEAN_AND_MEAN + _CRT_SECURE_NO_WARNINGS +- _HAS_EXCEPTIONS=0 + _UNICODE + ) + endif() +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 00ac137..87243fc 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -68,8 +68,8 @@ endif() + if(MSVC) + option(SENTRY_BUILD_RUNTIMESTATIC "Build sentry-native with static runtime" OFF) + +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /utf-8") +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /utf-8") ++ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /utf-8 /EHsc") ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /utf-8 /EHsc") + endif() + + if(LINUX) +diff --git a/external/crashpad/third_party/mini_chromium/CMakeLists.txt b/external/crashpad/third_party/mini_chromium/CMakeLists.txt +index 177f1300..85bf352f 100644 +--- a/external/crashpad/third_party/mini_chromium/CMakeLists.txt ++++ b/external/crashpad/third_party/mini_chromium/CMakeLists.txt +@@ -191,7 +191,6 @@ if(WIN32) + UNICODE + WIN32_LEAN_AND_MEAN + _CRT_SECURE_NO_WARNINGS +- _HAS_EXCEPTIONS=0 + _UNICODE + ) + elseif(MINGW) diff --git a/repo/packages/s/sentry-native/xmake.lua b/repo/packages/s/sentry-native/xmake.lua index b2fc1a46d..322446cd3 100644 --- a/repo/packages/s/sentry-native/xmake.lua +++ b/repo/packages/s/sentry-native/xmake.lua @@ -34,6 +34,7 @@ package("sentry-native") add_versions("0.4.15", "ae3ac4efa76d431d8734d7b0b1bf9bbedaf2cbdb18dfc5c95e2411a67808cf29") add_versions("0.4.4", "fe6c711d42861e66e53bfd7ee0b2b226027c64446857f0d1bbb239ca824a3d8d") add_patches("0.4.4", path.join(os.scriptdir(), "patches", "0.4.4", "zlib_fix.patch"), "1a6ac711b7824112a9062ec1716a316facce5055498d1f87090d2cad031b865b") + add_patches("0.7.6", path.join(os.scriptdir(), "patches", "0.7.6", "breakpad_exceptions.patch"), "7781bad0404a92252cbad39e865d17ac663eedade03cbd29c899636c7bfab1b5") add_deps("cmake") @@ -103,7 +104,9 @@ package("sentry-native") if package:is_plat("windows") then -- opt.cxflags = { "/experimental:preprocessor-" } -- fixes <Windows SDK>\um\oaidl.h(487): error C2059: syntax error: '/' local vs_runtime = package:runtimes() - table.insert(configs, "-DSENTRY_BUILD_RUNTIMESTATIC=" .. ((vs_runtime == "MT" or vs_runtime == "MTd") and "ON" or "OFF")) + local runtime_static = ((vs_runtime == "MT" or vs_runtime == "MTd") and "ON" or "OFF"); + --print("vs_runtime: " .. vs_runtime .. ", runtime_static: " .. runtime_static) + table.insert(configs, "-DSENTRY_BUILD_RUNTIMESTATIC=" .. runtime_static) elseif package:is_plat("macosx") then opt.shflags = {"-framework", "SystemConfiguration"} end @@ -2,6 +2,24 @@ set_configvar("ZEN_SCHEMA_VERSION", 5) -- force state wipe after 0.2.31 causing bad data (dan.engelbrecht) +if is_plat("windows") then + if false then + -- DLL runtime + if is_mode("debug") then + set_runtimes("MDd") + else + set_runtimes("MD") + end + else + -- static runtime + if is_mode("debug") then + set_runtimes("MTd") + else + set_runtimes("MT") + end + end +end + add_repositories("zen-repo repo") set_policy("build.ccache", false) set_policy("package.precompiled", false) @@ -12,7 +30,6 @@ add_requires("lua", {system = false}) add_requires("http_parser", {system = false}) add_requires("mimalloc", {system = false}) add_requires("eastl", {system = false}) -add_requires("zlib", {system = false}) add_requires("libcurl", {system = false}) add_defines("EASTL_STD_ITERATOR_CATEGORY_ENABLED", "EASTL_DEPRECATIONS_FOR_2024_APRIL=EA_DISABLED") @@ -43,7 +60,7 @@ if has_config("zensentry") then if is_plat("linux") then add_requires("sentry-native 0.7.6") else - add_requires("sentry-native 0.7.6", {configs = {backend = "breakpad"}}) + add_requires("sentry-native 0.7.6", {configs = {backend = "crashpad"}}) end end |