https://bugs.gentoo.org/928892 https://gitlab.gnome.org/GNOME/libdex/-/commit/fc0ef0544dd61ff6d825c53323d4b4cba4481a03 https://gitlab.gnome.org/GNOME/libdex/-/merge_requests/17 From fc0ef0544dd61ff6d825c53323d4b4cba4481a03 Mon Sep 17 00:00:00 2001 From: Alfred Wingate Date: Wed, 29 Jan 2025 07:16:41 +0200 Subject: [PATCH] build: try libucontext if symbols are not present Musl includes uncontext.h but doesn't implement the symbols. This means that HAVE_CONTEXT_H will be set and linking will fail due to missing symbols. https://wiki.musl-libc.org/open-issues.html#ucontext.h If the symbols are missing depend on libucontext which is an implementation of these functions for musl. https://github.com/kaniini/libucontext Bug: https://bugs.gentoo.org/928892 Signed-off-by: Alfred Wingate --- a/meson.build +++ b/meson.build @@ -44,14 +44,14 @@ if get_option('sysprof') config_h.set10('HAVE_SYSPROF', true) endif -check_headers = [ - 'ucontext.h', -] -foreach h : check_headers - if cc.has_header(h) - config_h.set('HAVE_' + h.underscorify().to_upper(), 1) +if cc.has_header('ucontext.h') + if not cc.has_function('makecontext', prefix : '#include ') + libucontext_dep = dependency('libucontext', required: false) + else + libucontext_dep = disabler() endif -endforeach + config_h.set('HAVE_UCONTEXT_H', 1) +endif if host_machine.system() == 'darwin' # known alignment for darwin where we're using helpers --- a/src/meson.build +++ b/src/meson.build @@ -95,6 +95,9 @@ if host_machine.system() != 'windows' 'dex-unix-signal.c', 'dex-ucontext.c', ] + if libucontext_dep.found() + libdex_deps += [libucontext_dep] + endif # If we're on Linux and mips we might still need asm.S. # But otherwise linux can do it all without any custom -- GitLab