aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2020-03-21 19:30:13 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2020-03-22 23:07:53 +0200
commit9e5c881b06bfb79ee9ee40cdd8dca3a78f268a40 (patch)
tree010ef213ef675f1f136b0731420c860905a4934d
parent1cf7799df26232dda45fd94a2c5e2b1ad3851c3d (diff)
downloadmeson-9e5c881b06bfb79ee9ee40cdd8dca3a78f268a40.zip
meson-9e5c881b06bfb79ee9ee40cdd8dca3a78f268a40.tar.gz
meson-9e5c881b06bfb79ee9ee40cdd8dca3a78f268a40.tar.bz2
Add property to disable compiler sanity checks during cross compilation.
-rw-r--r--cross/ubuntu-armhf.txt2
-rw-r--r--docs/markdown/snippets/skipsanity.md9
-rw-r--r--mesonbuild/interpreter.py15
-rw-r--r--mesonbuild/mlog.py2
4 files changed, 26 insertions, 2 deletions
diff --git a/cross/ubuntu-armhf.txt b/cross/ubuntu-armhf.txt
index 45a272a..4600c22 100644
--- a/cross/ubuntu-armhf.txt
+++ b/cross/ubuntu-armhf.txt
@@ -18,6 +18,8 @@ cpp_args = '-DMESON_TEST_ISSUE_1665=1'
has_function_printf = true
has_function_hfkerhisadf = false
+skip_sanity_check = true
+
[host_machine]
system = 'linux'
cpu_family = 'arm'
diff --git a/docs/markdown/snippets/skipsanity.md b/docs/markdown/snippets/skipsanity.md
new file mode 100644
index 0000000..94730a2
--- /dev/null
+++ b/docs/markdown/snippets/skipsanity.md
@@ -0,0 +1,9 @@
+## Skip sanity tests when cross compiling
+
+For certain cross compilation environments it is not possible to
+compile a sanity check application. This can now be disabled by adding
+the following entry to your cross file's `properties` section:
+
+```
+skip_sanity_check = true
+```
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index eb3c5fe..970b709 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -3080,6 +3080,16 @@ external dependencies (including libraries) must go to "dependencies".''')
self._redetect_machines()
return success
+ def should_skip_sanity_check(self, for_machine: MachineChoice) -> bool:
+ if for_machine != MachineChoice.HOST:
+ return False
+ if not self.environment.is_cross_build():
+ return False
+ should = self.environment.properties.host.get('skip_sanity_check', False)
+ if not isinstance(should, bool):
+ raise InterpreterException('Option skip_sanity_check must be a boolean.')
+ return should
+
def add_languages_for(self, args, required, for_machine: MachineChoice):
success = True
for lang in sorted(args, key=compilers.sort_clink):
@@ -3093,7 +3103,10 @@ external dependencies (including libraries) must go to "dependencies".''')
comp = self.environment.detect_compiler_for(lang, for_machine)
if comp is None:
raise InvalidArguments('Tried to use unknown language "%s".' % lang)
- comp.sanity_check(self.environment.get_scratch_dir(), self.environment)
+ if self.should_skip_sanity_check(for_machine):
+ mlog.log_once('Cross compiler sanity tests disabled via the cross file.')
+ else:
+ comp.sanity_check(self.environment.get_scratch_dir(), self.environment)
except Exception:
if not required:
mlog.log('Compiler for language',
diff --git a/mesonbuild/mlog.py b/mesonbuild/mlog.py
index 7d9dc16..a5fb320 100644
--- a/mesonbuild/mlog.py
+++ b/mesonbuild/mlog.py
@@ -213,7 +213,7 @@ def log_once(*args: T.Union[str, AnsiDecorator], is_error: bool = False,
**kwargs: T.Any) -> None:
"""Log variant that only prints a given message one time per meson invocation.
- This considers nasi decorated values by the values they wrap without
+ This considers ansi decorated values by the values they wrap without
regard for the AnsiDecorator itself.
"""
t = tuple(a.text if isinstance(a, AnsiDecorator) else a for a in args)