From 676e8c73057f0a7b817b8ee81bededd1823d0b9a Mon Sep 17 00:00:00 2001 From: deepend Date: Thu, 19 Feb 2026 12:29:21 -0700 Subject: [PATCH] Updated the Darwin architecture sanity check in meson.build to consider Meson-provided c_args and c_link_args in addition to CFLAGS/LDFLAGS, so x86_64/universal targeting is detected even when -arch flags are passed via Meson options. This makes the early configure-time guard catch the Homebrew arm64-vs-x86_64 mismatch before the later linker failure you hit. Kept the existing error behavior intact; only the architecture signal source was expanded (all_cflags / all_ldflags), so the same user-facing failure path now triggers in more real-world universal build setups. --- meson.build | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 56b40127..ff15eadd 100644 --- a/meson.build +++ b/meson.build @@ -47,10 +47,14 @@ endif if host_machine.system() == 'darwin' and darwin_arch_sanity_check cflags_env = run_command('sh', '-c', 'printf %s "$CFLAGS"', check: false).stdout().strip() ldflags_env = run_command('sh', '-c', 'printf %s "$LDFLAGS"', check: false).stdout().strip() + c_args_opt = ' ' + ' '.join(get_option('c_args')) + ' ' + c_link_args_opt = ' ' + ' '.join(get_option('c_link_args')) + ' ' + all_cflags = cflags_env + ' ' + c_args_opt + all_ldflags = ldflags_env + ' ' + c_link_args_opt pkgconfig_glib = run_command('pkg-config', '--libs-only-L', 'glib-2.0', check: false) - targeting_x86_64 = cflags_env.contains('-arch x86_64') or ldflags_env.contains('-arch x86_64') - targeting_arm64 = cflags_env.contains('-arch arm64') or ldflags_env.contains('-arch arm64') + targeting_x86_64 = all_cflags.contains('-arch x86_64') or all_ldflags.contains('-arch x86_64') + targeting_arm64 = all_cflags.contains('-arch arm64') or all_ldflags.contains('-arch arm64') targeting_universal = targeting_x86_64 and targeting_arm64 using_arm_homebrew = pkgconfig_glib.returncode() == 0 and pkgconfig_glib.stdout().contains('/opt/homebrew/')