commit: b4a51c4f9d57999ca18e68e779438a42b0a6b6b4
parent 3fd09cc53f57d28951e10d3a5a33bdc3392d3d00
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Fri, 8 Aug 2025 13:52:53 +0200
gui-libs/gtk: Check for non-standard backtrace() instead of assuming it
Diffstat:
1 file changed, 51 insertions(+), 0 deletions(-)
diff --git a/patches/gui-libs/gtk/0001-Check-for-non-standard-backtrace-instead-of-assuming.patch b/patches/gui-libs/gtk/0001-Check-for-non-standard-backtrace-instead-of-assuming.patch
@@ -0,0 +1,51 @@
+From 4f080dbeaa7a4c93d8b0690be04839f470256d87 Mon Sep 17 00:00:00 2001
+From: "Haelwenn (lanodan) Monnier" <contact@hacktivis.me>
+Date: Fri, 8 Aug 2025 13:51:17 +0200
+Subject: [PATCH] Check for non-standard backtrace() instead of assuming it
+
+Fixes building GTK4 tests on musl
+---
+ meson.build | 2 ++
+ testsuite/reftests/gtk-reftest.c | 4 ++--
+ 2 files changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/meson.build b/meson.build
+index 679a222..ee6c902 100644
+--- a/meson.build
++++ b/meson.build
+@@ -276,6 +276,8 @@ if cc.compiles(uint128_t_src, name : '__uint128_t available')
+ cdata.set('HAVE_UINT128_T', 1)
+ endif
+
++cdata.set('HAVE_BACKTRACE', cc.has_function('backtrace', prefix: '#include <execinfo.h>'))
++
+ # Disable deprecation checks for all libraries we depend on on stable branches.
+ # This is so newer versions of those libraries don't cause more warnings with
+ # a stable GTK version.
+diff --git a/testsuite/reftests/gtk-reftest.c b/testsuite/reftests/gtk-reftest.c
+index 154a2a6..f8ab45f 100644
+--- a/testsuite/reftests/gtk-reftest.c
++++ b/testsuite/reftests/gtk-reftest.c
+@@ -24,7 +24,7 @@
+ #include "reftest-module.h"
+ #include "reftest-snapshot.h"
+
+-#ifndef G_OS_WIN32
++#ifdef HAVE_BACKTRACE
+ #include <execinfo.h>
+ #endif
+ #include <string.h>
+@@ -469,7 +469,7 @@ log_writer (GLogLevelFlags log_level,
+ gsize n_fields,
+ gpointer user_data)
+ {
+-#if !defined (G_OS_WIN32) && !defined (__ANDROID__)
++#ifdef HAVE_BACKTRACE
+ if (log_level & G_LOG_LEVEL_CRITICAL)
+ {
+ void *buffer[1024];
+
+base-commit: 9636aa03910165c130cd3e8ef4e9681728d6dd5a
+--
+2.49.1
+