Skip to content

Commit aa486f5

Browse files
arteymixjpakkane
authored andcommitted
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').
1 parent 33b5ddf commit aa486f5

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

mesonbuild/backend/ninjabackend.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,10 +1060,15 @@ def generate_vala_compile(self, target, outfile):
10601060
vala_c_src.append(vala_c_file)
10611061
valac_outputs.append(vala_c_file)
10621062

1063+
# TODO: Use self.generate_basic_compiler_args to get something more
1064+
# consistent Until then, we should be careful to preserve the
1065+
# precedence of arguments if it changes upstream.
10631066
args = []
1064-
args += self.build.get_global_args(valac)
1065-
args += self.build.get_project_args(valac, target.subproject)
10661067
args += valac.get_buildtype_args(self.get_option_for_target('buildtype', target))
1068+
args += self.build.get_project_args(valac, target.subproject)
1069+
args += self.build.get_global_args(valac)
1070+
args += self.environment.coredata.external_args[valac.get_language()]
1071+
10671072
# Tell Valac to output everything in our private directory. Sadly this
10681073
# means it will also preserve the directory components of Vala sources
10691074
# found inside the build tree (generated sources).

mesonbuild/environment.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -809,16 +809,18 @@ def log_var(var, val):
809809
if hasattr(compiler, 'get_linker_exelist'):
810810
compiler_is_linker = (compiler.get_exelist() == compiler.get_linker_exelist())
811811

812-
if lang not in ('c', 'cpp', 'objc', 'objcpp', 'fortran', 'd'):
813-
return [], [], []
814-
815812
# Compile flags
816813
cflags_mapping = {'c': 'CFLAGS',
817814
'cpp': 'CXXFLAGS',
818815
'objc': 'OBJCFLAGS',
819816
'objcpp': 'OBJCXXFLAGS',
820817
'fortran': 'FFLAGS',
821-
'd': 'DFLAGS'}
818+
'd': 'DFLAGS',
819+
'vala': 'VALAFLAGS'}
820+
821+
if lang not in cflags_mapping.keys():
822+
return [], [], []
823+
822824
compile_flags = os.environ.get(cflags_mapping[lang], '')
823825
log_var(cflags_mapping[lang], compile_flags)
824826
compile_flags = shlex.split(compile_flags)

0 commit comments

Comments
 (0)