From aa486f5bb2b962ee6f5f65cabe05bb33f92ebead Mon Sep 17 00:00:00 2001 From: Guillaume Poirier-Morency Date: Wed, 26 Oct 2016 12:13:36 -0400 Subject: vala: Add 'VALAFLAGS' to considered environment variables Fix precedence of arguments for Vala tasks and include those considered external (i.e. '-Dvala_args' and 'VALAFLAGS'). --- mesonbuild/backend/ninjabackend.py | 9 +++++++-- mesonbuild/environment.py | 10 ++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index db136c7..cc02e5d 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -1060,10 +1060,15 @@ int dummy; vala_c_src.append(vala_c_file) valac_outputs.append(vala_c_file) + # TODO: Use self.generate_basic_compiler_args to get something more + # consistent Until then, we should be careful to preserve the + # precedence of arguments if it changes upstream. args = [] - args += self.build.get_global_args(valac) - args += self.build.get_project_args(valac, target.subproject) args += valac.get_buildtype_args(self.get_option_for_target('buildtype', target)) + args += self.build.get_project_args(valac, target.subproject) + args += self.build.get_global_args(valac) + args += self.environment.coredata.external_args[valac.get_language()] + # Tell Valac to output everything in our private directory. Sadly this # means it will also preserve the directory components of Vala sources # found inside the build tree (generated sources). diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index cb28897..61425a4 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -809,16 +809,18 @@ def get_args_from_envvars(compiler): if hasattr(compiler, 'get_linker_exelist'): compiler_is_linker = (compiler.get_exelist() == compiler.get_linker_exelist()) - if lang not in ('c', 'cpp', 'objc', 'objcpp', 'fortran', 'd'): - return [], [], [] - # Compile flags cflags_mapping = {'c': 'CFLAGS', 'cpp': 'CXXFLAGS', 'objc': 'OBJCFLAGS', 'objcpp': 'OBJCXXFLAGS', 'fortran': 'FFLAGS', - 'd': 'DFLAGS'} + 'd': 'DFLAGS', + 'vala': 'VALAFLAGS'} + + if lang not in cflags_mapping.keys(): + return [], [], [] + compile_flags = os.environ.get(cflags_mapping[lang], '') log_var(cflags_mapping[lang], compile_flags) compile_flags = shlex.split(compile_flags) -- cgit v1.1