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 | |||
| 11 | file://0003-native_bindir.patch \ | 11 | file://0003-native_bindir.patch \ |
| 12 | file://0004-Prettifying-some-output-with-pathlib.patch \ | 12 | file://0004-Prettifying-some-output-with-pathlib.patch \ |
| 13 | file://0005-Set-the-meson-command-to-use-when-we-know-what-it-is.patch \ | 13 | file://0005-Set-the-meson-command-to-use-when-we-know-what-it-is.patch \ |
| 14 | file://validate-cpu.patch \ | ||
| 14 | " | 15 | " |
| 15 | 16 | ||
| 16 | SRC_URI[md5sum] = "1698f6526574839de5dcdc45e3f7d582" | 17 | 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 @@ | |||
| 1 | Validate the passed CPU family (US: backport) and turn the upstream warning to | ||
| 2 | an error (US: inappropriate). | ||
| 3 | |||
| 4 | Upstream-Status: Backport | ||
| 5 | Signed-off-by: Ross Burton <ross.burton@intel.com> | ||
| 6 | |||
| 7 | From 456f7ea48503731d50a2b7287a0f198b73b4fe61 Mon Sep 17 00:00:00 2001 | ||
| 8 | From: Ross Burton <ross@burtonini.com> | ||
| 9 | Date: Wed, 20 Jun 2018 13:45:44 +0100 | ||
| 10 | Subject: [PATCH 1/2] Validate cpu_family (#3753) | ||
| 11 | |||
| 12 | * environment: validate cpu_family in cross file | ||
| 13 | |||
| 14 | * run_unittests: add unittest to ensure CPU family list in docs and environment matches | ||
| 15 | |||
| 16 | * run_unittests: skip compiler options test if not in a git repository | ||
| 17 | |||
| 18 | * environment: validate the detected cpu_family | ||
| 19 | |||
| 20 | * docs: add 32-bit PowerPC and 32/64-bit MIPS to CPU Families table | ||
| 21 | |||
| 22 | Names gathered by booting Linux in Qemu and running: | ||
| 23 | |||
| 24 | $ python3 | ||
| 25 | import platform; platform.machine() | ||
| 26 | |||
| 27 | Partial fix for #3751 | ||
| 28 | --- | ||
| 29 | mesonbuild/environment.py | 24 ++++++++++++++++++++++++ | ||
| 30 | 1 file changed, 24 insertions(+) | ||
| 31 | |||
| 32 | diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py | ||
| 33 | index 6920b8d6..091d92dc 100644 | ||
| 34 | --- a/mesonbuild/environment.py | ||
| 35 | +++ b/mesonbuild/environment.py | ||
| 36 | @@ -72,6 +72,22 @@ from .compilers import ( | ||
| 37 | |||
| 38 | build_filename = 'meson.build' | ||
| 39 | |||
| 40 | +known_cpu_families = ( | ||
| 41 | + 'aarch64', | ||
| 42 | + 'arm', | ||
| 43 | + 'e2k', | ||
| 44 | + 'ia64', | ||
| 45 | + 'mips', | ||
| 46 | + 'mips64', | ||
| 47 | + 'parisc', | ||
| 48 | + 'ppc', | ||
| 49 | + 'ppc64', | ||
| 50 | + 'ppc64le', | ||
| 51 | + 'sparc64', | ||
| 52 | + 'x86', | ||
| 53 | + 'x86_64' | ||
| 54 | +) | ||
| 55 | + | ||
| 56 | # Environment variables that each lang uses. | ||
| 57 | cflags_mapping = {'c': 'CFLAGS', | ||
| 58 | 'cpp': 'CXXFLAGS', | ||
| 59 | @@ -210,6 +226,10 @@ def detect_cpu_family(compilers): | ||
| 60 | pass | ||
| 61 | return 'x86_64' | ||
| 62 | # Add fixes here as bugs are reported. | ||
| 63 | + | ||
| 64 | + if trial not in known_cpu_families: | ||
| 65 | + mlog.warning('Unknown CPU family %s, please report this at https://github.com/mesonbuild/meson/issues/new' % trial) | ||
| 66 | + | ||
| 67 | return trial | ||
| 68 | |||
| 69 | def detect_cpu(compilers): | ||
| 70 | @@ -1021,6 +1041,10 @@ class CrossBuildInfo: | ||
| 71 | res = eval(value, {'__builtins__': None}, {'true': True, 'false': False}) | ||
| 72 | except Exception: | ||
| 73 | raise EnvironmentException('Malformed value in cross file variable %s.' % entry) | ||
| 74 | + | ||
| 75 | + if entry == 'cpu_family' and res not in known_cpu_families: | ||
| 76 | + mlog.warning('Unknown CPU family %s, please report this at https://github.com/mesonbuild/meson/issues/new' % value) | ||
| 77 | + | ||
| 78 | if self.ok_type(res): | ||
| 79 | self.config[s][entry] = res | ||
| 80 | elif isinstance(res, list): | ||
| 81 | -- | ||
| 82 | 2.11.0 | ||
| 83 | |||
| 84 | |||
| 85 | From 202e0199d3ffd2637f4dbee08f8351520f7dde3b Mon Sep 17 00:00:00 2001 | ||
| 86 | From: Ross Burton <ross.burton@intel.com> | ||
| 87 | Date: Tue, 3 Jul 2018 13:59:09 +0100 | ||
| 88 | Subject: [PATCH 2/2] Make CPU family warnings fatal | ||
| 89 | |||
| 90 | --- | ||
| 91 | mesonbuild/environment.py | 4 ++-- | ||
| 92 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
| 93 | |||
| 94 | diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py | ||
| 95 | index 091d92dc..67177c1f 100644 | ||
| 96 | --- a/mesonbuild/environment.py | ||
| 97 | +++ b/mesonbuild/environment.py | ||
| 98 | @@ -228,7 +228,7 @@ def detect_cpu_family(compilers): | ||
| 99 | # Add fixes here as bugs are reported. | ||
| 100 | |||
| 101 | if trial not in known_cpu_families: | ||
| 102 | - mlog.warning('Unknown CPU family %s, please report this at https://github.com/mesonbuild/meson/issues/new' % trial) | ||
| 103 | + raise EnvironmentException('Unknown CPU family %s, please report this at https://github.com/mesonbuild/meson/issues/new' % trial) | ||
| 104 | |||
| 105 | return trial | ||
| 106 | |||
| 107 | @@ -1043,7 +1043,7 @@ class CrossBuildInfo: | ||
| 108 | raise EnvironmentException('Malformed value in cross file variable %s.' % entry) | ||
| 109 | |||
| 110 | if entry == 'cpu_family' and res not in known_cpu_families: | ||
| 111 | - mlog.warning('Unknown CPU family %s, please report this at https://github.com/mesonbuild/meson/issues/new' % value) | ||
| 112 | + raise EnvironmentException('Unknown CPU family %s, please report this at https://github.com/mesonbuild/meson/issues/new' % value) | ||
| 113 | |||
| 114 | if self.ok_type(res): | ||
| 115 | self.config[s][entry] = res | ||
| 116 | -- | ||
| 117 | 2.11.0 | ||
| 118 | |||
