diff options
-rw-r--r-- | meta/recipes-devtools/meson/meson.inc | 1 | ||||
-rw-r--r-- | meta/recipes-devtools/meson/meson/validate-cpu.patch | 118 |
2 files changed, 119 insertions, 0 deletions
diff --git a/meta/recipes-devtools/meson/meson.inc b/meta/recipes-devtools/meson/meson.inc index 4c113dcaf7..b278d33b72 100644 --- a/meta/recipes-devtools/meson/meson.inc +++ b/meta/recipes-devtools/meson/meson.inc @@ -11,6 +11,7 @@ SRC_URI = "https://github.com/mesonbuild/meson/releases/download/${PV}/meson-${P file://0003-native_bindir.patch \ file://0004-Prettifying-some-output-with-pathlib.patch \ file://0005-Set-the-meson-command-to-use-when-we-know-what-it-is.patch \ + file://validate-cpu.patch \ " SRC_URI[md5sum] = "1698f6526574839de5dcdc45e3f7d582" diff --git a/meta/recipes-devtools/meson/meson/validate-cpu.patch b/meta/recipes-devtools/meson/meson/validate-cpu.patch new file mode 100644 index 0000000000..8bdb204ab0 --- /dev/null +++ b/meta/recipes-devtools/meson/meson/validate-cpu.patch @@ -0,0 +1,118 @@ +Validate the passed CPU family (US: backport) and turn the upstream warning to +an error (US: inappropriate). + +Upstream-Status: Backport +Signed-off-by: Ross Burton <ross.burton@intel.com> + +From 456f7ea48503731d50a2b7287a0f198b73b4fe61 Mon Sep 17 00:00:00 2001 +From: Ross Burton <ross@burtonini.com> +Date: Wed, 20 Jun 2018 13:45:44 +0100 +Subject: [PATCH 1/2] 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 +--- + mesonbuild/environment.py | 24 ++++++++++++++++++++++++ + 1 file changed, 24 insertions(+) + +diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py +index 6920b8d6..091d92dc 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' ++) ++ + # Environment variables that each lang uses. + cflags_mapping = {'c': 'CFLAGS', + 'cpp': 'CXXFLAGS', +@@ -210,6 +226,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): +@@ -1021,6 +1041,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): +-- +2.11.0 + + +From 202e0199d3ffd2637f4dbee08f8351520f7dde3b Mon Sep 17 00:00:00 2001 +From: Ross Burton <ross.burton@intel.com> +Date: Tue, 3 Jul 2018 13:59:09 +0100 +Subject: [PATCH 2/2] Make CPU family warnings fatal + +--- + mesonbuild/environment.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py +index 091d92dc..67177c1f 100644 +--- a/mesonbuild/environment.py ++++ b/mesonbuild/environment.py +@@ -228,7 +228,7 @@ def detect_cpu_family(compilers): + # 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) ++ raise EnvironmentException('Unknown CPU family %s, please report this at https://github.com/mesonbuild/meson/issues/new' % trial) + + return trial + +@@ -1043,7 +1043,7 @@ class CrossBuildInfo: + 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) ++ raise EnvironmentException('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 +-- +2.11.0 + |