diff --git a/docs/markdown/Reference-tables.md b/docs/markdown/Reference-tables.md index b553832eb..377b36286 100644 --- a/docs/markdown/Reference-tables.md +++ b/docs/markdown/Reference-tables.md @@ -175,7 +175,8 @@ Native names as returned by the `.kernel()` method. | netbsd | | | nt | | | xnu | Kernel of various Apple OSes | -| sunos | | +| illumos | Kernel derived from OpenSolaris by community efforts | +| solaris | Kernel derived from OpenSolaris by Oracle | | dragonfly | | | haiku| | | none | For e.g. bare metal embedded | diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index 688070f4a..ff7ae3ae9 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -403,12 +403,23 @@ KERNEL_MAPPINGS: T.Mapping[str, str] = {'freebsd': 'freebsd', 'linux': 'linux', 'cygwin': 'nt', 'darwin': 'xnu', - 'sunos': 'sunos', 'dragonfly': 'dragonfly', 'haiku': 'haiku', } def detect_kernel(system: str) -> T.Optional[str]: + if system == 'sunos': + # This needs to be /usr/bin/uname because gnu-uname could be installed and + # won't provide the necessary information + p, out, _ = Popen_safe(['/usr/bin/uname', '-o']) + if p.returncode != 0: + raise MesonException('Failed to run "/usr/bin/uname -o"') + out = out.lower().strip() + if out not in {'illumos', 'solaris'}: + mlog.warning(f'Got an unexpected value for kernel on a SunOS derived platform, expcted either "illumos" or "solaris", but got "{out}".' + "Please open a Meson issue with the OS you're running and the value detected for your kernel.") + return None + return out return KERNEL_MAPPINGS.get(system, None) def detect_subsystem(system: str) -> T.Optional[str]: