aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/vala.py
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2018-10-04 20:52:08 -0400
committerJohn Ericson <git@JohnEricson.me>2019-06-09 13:13:25 -0400
commit07777e15d47dbddaf849d24b3a30c85745c533ca (patch)
treef472472ed511498c329b4e13e19b1585e1afb621 /mesonbuild/compilers/vala.py
parent32e827dcdc451e1c5dde952cf08e4b654eac7057 (diff)
downloadmeson-07777e15d47dbddaf849d24b3a30c85745c533ca.zip
meson-07777e15d47dbddaf849d24b3a30c85745c533ca.tar.gz
meson-07777e15d47dbddaf849d24b3a30c85745c533ca.tar.bz2
Purge `is_cross` and friends without changing user interfaces
In most cases instead pass `for_machine`, the name of the relevant machines (what compilers target, what targets run on, etc). This allows us to use the cross code path in the native case, deduplicating the code. As one can see, environment got bigger as more information is kept structured there, while ninjabackend got a smaller. Overall a few amount of lines were added, but the hope is what's added is a lot simpler than what's removed.
Diffstat (limited to 'mesonbuild/compilers/vala.py')
-rw-r--r--mesonbuild/compilers/vala.py20
1 files changed, 6 insertions, 14 deletions
diff --git a/mesonbuild/compilers/vala.py b/mesonbuild/compilers/vala.py
index c0b2a68..0a612ae 100644
--- a/mesonbuild/compilers/vala.py
+++ b/mesonbuild/compilers/vala.py
@@ -20,12 +20,12 @@ from ..mesonlib import EnvironmentException, MachineChoice, version_compare
from .compilers import Compiler
class ValaCompiler(Compiler):
- def __init__(self, exelist, version):
+ def __init__(self, exelist, version, for_machine: MachineChoice, is_cross):
self.language = 'vala'
- super().__init__(exelist, version)
+ super().__init__(exelist, version, for_machine)
self.version = version
+ self.is_cross = is_cross
self.id = 'valac'
- self.is_cross = False
self.base_options = ['b_colorout']
def name_string(self):
@@ -87,15 +87,11 @@ class ValaCompiler(Compiler):
def sanity_check(self, work_dir, environment):
code = 'class MesonSanityCheck : Object { }'
- 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)
+ extra_flags = environment.coredata.get_external_args(self.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)
+ extra_flags += environment.coredata.get_external_link_args(self.for_machine, self.language)
with self.cached_compile(code, environment.coredata, extra_args=extra_flags, mode='compile') as p:
if p.returncode != 0:
msg = 'Vala compiler {!r} can not compile programs' \
@@ -114,11 +110,7 @@ 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)
+ args = env.coredata.get_external_args(self.for_machine, self.language)
vapi_args = ['--pkg', libname]
args += vapi_args
with self.cached_compile(code, env.coredata, extra_args=args, mode='compile') as p: