From 5c8df002295f15e1915a628445e2ebc5ff5f8dbb Mon Sep 17 00:00:00 2001 From: Gurchetan Singh Date: Wed, 13 May 2026 15:16:59 -0700 Subject: [PATCH] Add initial detection for Fuchsia Fuchsia is a microkernel-like OS that takes many cues from Plan9. Co-Authored-by: Dylan Baker --- docs/markdown/Reference-tables.md | 4 +++- mesonbuild/envconfig.py | 4 ++++ mesonbuild/utils/universal.py | 5 +++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/markdown/Reference-tables.md b/docs/markdown/Reference-tables.md index faa039bfe..9c17ab35c 100644 --- a/docs/markdown/Reference-tables.md +++ b/docs/markdown/Reference-tables.md @@ -176,6 +176,7 @@ These are provided by the `.system()` method call. | windows | Native Windows (not Cygwin or MSYS2) | | sunos | illumos and Solaris | | os/2 | OS/2 | +| fuchsia | Google's Fuchsia | Any string not listed above is not guaranteed to remain stable in future releases. @@ -197,7 +198,8 @@ Native names as returned by the `.kernel()` method. | solaris | Kernel derived from OpenSolaris by Oracle | | dragonfly | | | haiku| | -| none | For e.g. bare metal embedded | +| fuchsia | Google's Fuchsia | +| none | For e.g. bare metal embedded | ## Subsystem names (since 1.2.0) diff --git a/mesonbuild/envconfig.py b/mesonbuild/envconfig.py index b0072a49b..c1940cd1f 100644 --- a/mesonbuild/envconfig.py +++ b/mesonbuild/envconfig.py @@ -396,6 +396,9 @@ class MachineInfo(HoldableObject): """ return self.system == 'os/2' + def is_fuchsia(self) -> bool: + return self.system == 'fuchsia' + # Various prefixes and suffixes for import libraries, shared libraries, # static libraries, and executables. # Versioning is added to these names in the backends as-needed. @@ -523,6 +526,7 @@ KERNEL_MAPPINGS: T.Mapping[str, str] = {'freebsd': 'freebsd', 'dragonfly': 'dragonfly', 'haiku': 'haiku', 'gnu': 'gnu', + 'fuchsia': 'fuchsia', } def detect_windows_arch(compilers: CompilerDict) -> str: diff --git a/mesonbuild/utils/universal.py b/mesonbuild/utils/universal.py index 7b5f0a9a6..60ffeb8b9 100644 --- a/mesonbuild/utils/universal.py +++ b/mesonbuild/utils/universal.py @@ -134,6 +134,7 @@ __all__ = [ 'is_debianlike', 'is_dragonflybsd', 'is_freebsd', + 'is_fuchsia', 'is_haiku', 'is_hurd', 'is_irix', @@ -716,6 +717,10 @@ def is_android() -> bool: return _PLATFORM_SYSTEM_LOWER == 'android' +def is_fuchsia() -> bool: + return _PLATFORM_SYSTEM_LOWER == 'fuchsia' + + def is_haiku() -> bool: return _PLATFORM_SYSTEM_LOWER == 'haiku'