environment: separate illumos and Solaris kernels in Machines

While both kernels are derived from the OpenSolaris project of Sun, they
have diverged and code that works with one may not work with the other.
As such, we should provide different values for them. This was requested
by both Oracle and the illumos upstreams.

Fixes: #11922
pull/11939/head
Dylan Baker 2 years ago committed by Jussi Pakkanen
parent c34ee374a7
commit 42c68291c4
  1. 3
      docs/markdown/Reference-tables.md
  2. 13
      mesonbuild/environment.py

@ -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 |

@ -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]:

Loading…
Cancel
Save