From f4da210f464446d92600456508439d2f926e6cea Mon Sep 17 00:00:00 2001 From: John Ericson Date: Tue, 19 Mar 2019 20:44:51 -0400 Subject: Sanity check with external args Previously cross, but not native, external args were used. Then in d451a4bd97f827bb492fd0c0e357cb20b6056ed9 the cross special cases were removed, so external args are never used. This commit switches that so they are always used. Sanity checking works just the same as compiler checks like has header / has library. --- mesonbuild/compilers/vala.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'mesonbuild/compilers/vala.py') diff --git a/mesonbuild/compilers/vala.py b/mesonbuild/compilers/vala.py index b463f0d..98b8b42 100644 --- a/mesonbuild/compilers/vala.py +++ b/mesonbuild/compilers/vala.py @@ -15,7 +15,7 @@ import os.path from .. import mlog -from ..mesonlib import EnvironmentException, version_compare +from ..mesonlib import EnvironmentException, MachineChoice, version_compare from .compilers import Compiler @@ -87,7 +87,16 @@ class ValaCompiler(Compiler): def sanity_check(self, work_dir, environment): code = 'class MesonSanityCheck : Object { }' - with self.compile(code, [], 'compile') as p: + if environment.is_cross_build() and not self.is_cross: + for_machine = MachineChoice.BUILD + else: + for_machine = MachineChoice.HOST + extra_flags = environment.coredata.get_external_args(for_machine, self.language) + if self.is_cross: + extra_flags += self.get_compile_only_args() + else: + extra_flags += environment.coredata.get_external_link_args(for_machine, self.language) + with self.compile(code, extra_flags, 'compile') as p: if p.returncode != 0: msg = 'Vala compiler {!r} can not compile programs' \ ''.format(self.name_string()) @@ -105,8 +114,14 @@ class ValaCompiler(Compiler): # no extra dirs are specified. if not extra_dirs: code = 'class MesonFindLibrary : Object { }' + if env.is_cross_build() and not self.is_cross: + for_machine = MachineChoice.BUILD + else: + for_machine = MachineChoice.HOST + args = env.coredata.get_external_args(for_machine, self.language) vapi_args = ['--pkg', libname] - with self.compile(code, vapi_args, 'compile') as p: + args += vapi_args + with self.compile(code, args, 'compile') as p: if p.returncode == 0: return vapi_args # Not found? Try to find the vapi file itself. -- cgit v1.1