From 0a217f40d717a1a0c2c7207ca494d314faba5106 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Sun, 21 Oct 2018 23:49:34 +0300 Subject: [PATCH] Detect powerpc processors on FreeBSD. Closes #4397. --- mesonbuild/environment.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index 101d386c7..c1a36546c 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -211,6 +211,19 @@ def detect_cpu_family(compilers): return 'arm' if trial.startswith('ppc64'): return 'ppc64' + if trial == 'powerpc': + # 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: + return 'ppc64' + return 'ppc' + if 'powerpc64' in stdo: + return 'ppc64' + return 'ppc' if trial in ('amd64', 'x64'): trial = 'x86_64' if trial == 'x86_64':