diff options
author | Ross Burton <ross@burtonini.com> | 2018-06-20 13:45:44 +0100 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2018-06-20 12:45:44 +0000 |
commit | ecde1789b2152b3e987b41afc390ffa031a390ec (patch) | |
tree | 73c7af92d6e8994499ef20540695ba36f98f6297 /mesonbuild/environment.py | |
parent | 9fdf4d83e66f27715b1f0e3b7f86ad8c5c997024 (diff) | |
download | meson-ecde1789b2152b3e987b41afc390ffa031a390ec.zip meson-ecde1789b2152b3e987b41afc390ffa031a390ec.tar.gz meson-ecde1789b2152b3e987b41afc390ffa031a390ec.tar.bz2 |
Validate cpu_family (#3753)
* environment: validate cpu_family in cross file
* run_unittests: add unittest to ensure CPU family list in docs and environment matches
* run_unittests: skip compiler options test if not in a git repository
* environment: validate the detected cpu_family
* docs: add 32-bit PowerPC and 32/64-bit MIPS to CPU Families table
Names gathered by booting Linux in Qemu and running:
$ python3
import platform; platform.machine()
Partial fix for #3751
Diffstat (limited to 'mesonbuild/environment.py')
-rw-r--r-- | mesonbuild/environment.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index 5a5c053..793ed22 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -72,6 +72,22 @@ from .compilers import ( build_filename = 'meson.build' +known_cpu_families = ( + 'aarch64', + 'arm', + 'e2k', + 'ia64', + 'mips', + 'mips64', + 'parisc', + 'ppc', + 'ppc64', + 'ppc64le', + 'sparc64', + 'x86', + 'x86_64' +) + def detect_gcovr(version='3.1', log=False): gcovr_exe = 'gcovr' try: @@ -209,6 +225,10 @@ def detect_cpu_family(compilers): pass return 'x86_64' # Add fixes here as bugs are reported. + + if trial not in known_cpu_families: + mlog.warning('Unknown CPU family %s, please report this at https://github.com/mesonbuild/meson/issues/new' % trial) + return trial def detect_cpu(compilers): @@ -953,6 +973,10 @@ class CrossBuildInfo: res = eval(value, {'__builtins__': None}, {'true': True, 'false': False}) except Exception: raise EnvironmentException('Malformed value in cross file variable %s.' % entry) + + if entry == 'cpu_family' and res not in known_cpu_families: + mlog.warning('Unknown CPU family %s, please report this at https://github.com/mesonbuild/meson/issues/new' % value) + if self.ok_type(res): self.config[s][entry] = res elif isinstance(res, list): |