summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2020-03-21 19:30:13 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2020-03-21 19:30:13 +0200
commitff345eb49f8639b1481b6b90b572a7d495e265da (patch)
treeb2d7bcebf1cea49abd5c90d04cb936d2d2e06788
parent74602928100394f6129e064f8e0bfe6c9e08c9d2 (diff)
downloadmeson-skipcrosssanity.tar.gz
Add property to disable compiler sanity checks during cross compilation.skipcrosssanity
-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 45a272a81..4600c2281 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 000000000..94730a28f
--- /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 eb3c5fe7d..970b709ff 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 7d9dc16f4..a5fb3201b 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)