diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2019-03-19 20:44:51 -0400 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2019-03-27 10:54:56 -0400 |
commit | f4da210f464446d92600456508439d2f926e6cea (patch) | |
tree | 453a9a73eebc21dc055e20fa3911c0093d265245 /mesonbuild/compilers/vala.py | |
parent | b565eff084faeea8a8952ec2c1fe40483705aaef (diff) | |
download | meson-f4da210f464446d92600456508439d2f926e6cea.zip meson-f4da210f464446d92600456508439d2f926e6cea.tar.gz meson-f4da210f464446d92600456508439d2f926e6cea.tar.bz2 |
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.
Diffstat (limited to 'mesonbuild/compilers/vala.py')
-rw-r--r-- | mesonbuild/compilers/vala.py | 21 |
1 files changed, 18 insertions, 3 deletions
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. |