aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Beich <jbeich@FreeBSD.org>2019-08-04 06:18:25 +0000
committerJussi Pakkanen <jpakkane@gmail.com>2019-08-04 21:47:44 +0300
commit147d3f752c4133f176408eba336b8e587fc98142 (patch)
tree78494de6d73dfed5ebfdb43ab16ae689a7d05abf
parent5f2e44b0dd7bdac449d8679d9f0d8e71ad216245 (diff)
downloadmeson-147d3f752c4133f176408eba336b8e587fc98142.zip
meson-147d3f752c4133f176408eba336b8e587fc98142.tar.gz
meson-147d3f752c4133f176408eba336b8e587fc98142.tar.bz2
environment: simplify CPU logic via hw.machine_arch on BSDs
-rw-r--r--mesonbuild/environment.py19
1 files changed, 6 insertions, 13 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index 6c30fc1..1fca6fd 100644
--- a/mesonbuild/environment.py
+++ b/mesonbuild/environment.py
@@ -215,33 +215,24 @@ def detect_cpu_family(compilers: CompilersDict) -> str:
"""
if mesonlib.is_windows():
trial = detect_windows_arch(compilers)
+ elif mesonlib.is_freebsd() or mesonlib.is_openbsd():
+ trial = platform.processor().lower()
else:
trial = platform.machine().lower()
if trial.startswith('i') and trial.endswith('86'):
trial = 'x86'
elif trial == 'bepc':
trial = 'x86'
- # OpenBSD's 64 bit arm architecute identifies as 'arm64'
- elif trial == 'arm64':
- trial = 'aarch64'
elif trial.startswith('arm'):
trial = 'arm'
elif trial.startswith('ppc64'):
trial = 'ppc64'
elif trial == 'macppc':
trial = 'ppc'
+ elif trial == 'powerpc64':
+ trial = 'ppc64'
elif trial == 'powerpc':
trial = 'ppc'
- # FreeBSD calls both ppc and ppc64 "powerpc".
- # https://github.com/mesonbuild/meson/issues/4397
- try:
- p, stdo, _ = Popen_safe(['uname', '-p'])
- except (FileNotFoundError, PermissionError):
- # Not much to go on here.
- if sys.maxsize > 2**32:
- trial = 'ppc64'
- if 'powerpc64' in stdo:
- trial = 'ppc64'
elif trial in ('amd64', 'x64', 'i86pc'):
trial = 'x86_64'
@@ -271,6 +262,8 @@ def detect_cpu_family(compilers: CompilersDict) -> str:
def detect_cpu(compilers: CompilersDict):
if mesonlib.is_windows():
trial = detect_windows_arch(compilers)
+ elif mesonlib.is_freebsd() or mesonlib.is_openbsd():
+ trial = platform.processor().lower()
else:
trial = platform.machine().lower()
if trial in ('amd64', 'x64', 'i86pc'):