mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-03-10 07:50:19 +00:00
Added a new Meson option, darwin-arch-sanity-check (default true), so macOS users can explicitly disable the architecture-mismatch guard when they need to proceed in mixed toolchain environments.
Updated the Darwin architecture check to run only when darwin-arch-sanity-check is enabled, preserving current behavior by default while allowing opt-out.
Improved the check implementation to use pkg-config --libs-only-L glib-2.0 and only evaluate Homebrew path detection when the pkg-config call succeeds.
Extended the error message to include the explicit bypass flag -Ddarwin-arch-sanity-check=false for clearer remediation guidance.
This commit is contained in:
@@ -35,17 +35,18 @@ else
|
|||||||
required: get_option('tls'))
|
required: get_option('tls'))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if host_machine.system() == 'darwin'
|
if host_machine.system() == 'darwin' and get_option('darwin-arch-sanity-check')
|
||||||
cflags_env = run_command('sh', '-c', 'printf %s "$CFLAGS"', check: false).stdout().strip()
|
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()
|
ldflags_env = run_command('sh', '-c', 'printf %s "$LDFLAGS"', check: false).stdout().strip()
|
||||||
pkgconfig_libs = run_command('pkg-config', '--libs', 'glib-2.0', check: false).stdout()
|
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_x86_64 = cflags_env.contains('-arch x86_64') or ldflags_env.contains('-arch x86_64')
|
||||||
using_arm_homebrew = pkgconfig_libs.contains('/opt/homebrew/')
|
using_arm_homebrew = pkgconfig_glib.returncode() == 0 and pkgconfig_glib.stdout().contains('/opt/homebrew/')
|
||||||
|
|
||||||
if targeting_x86_64 and using_arm_homebrew
|
if targeting_x86_64 and using_arm_homebrew
|
||||||
error('Detected x86_64 build flags (-arch x86_64) while pkg-config resolves glib from /opt/homebrew (arm64). ' +
|
error('Detected x86_64 build flags (-arch x86_64) while pkg-config resolves glib from /opt/homebrew (arm64). ' +
|
||||||
'Use arm64 build flags with /opt/homebrew, or run an x86_64/Rosetta environment with an x86_64 dependency stack (typically /usr/local).')
|
'Use arm64 build flags with /opt/homebrew, or run an x86_64/Rosetta environment with an x86_64 dependency stack (typically /usr/local). ' +
|
||||||
|
'To bypass this safety check, configure with -Ddarwin-arch-sanity-check=false.')
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,9 @@ option('dbus', type: 'feature', value: 'auto',
|
|||||||
option('libcanberra', type: 'feature', value: 'auto',
|
option('libcanberra', type: 'feature', value: 'auto',
|
||||||
description: 'Support for sound alerts, Unix only'
|
description: 'Support for sound alerts, Unix only'
|
||||||
)
|
)
|
||||||
|
option('darwin-arch-sanity-check', type: 'boolean', value: true,
|
||||||
|
description: 'Fail fast when macOS build flags and Homebrew dependency architectures are mixed'
|
||||||
|
)
|
||||||
|
|
||||||
# Install options
|
# Install options
|
||||||
option('dbus-service-use-appid', type: 'boolean', value: false,
|
option('dbus-service-use-appid', type: 'boolean', value: false,
|
||||||
|
|||||||
Reference in New Issue
Block a user