aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/modules
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2022-03-22 20:19:24 -0400
committerXavier Claessens <xclaesse@gmail.com>2022-03-29 16:10:28 -0400
commite33ec88ac714b1d41cbfec28e80ee6bc046200eb (patch)
tree46cf4447a8e2d9d3987cdf9729023dd9a75df01f /mesonbuild/modules
parentd93fe56e89a027ec8fec9ad9d8176c6d7ee98543 (diff)
downloadmeson-e33ec88ac714b1d41cbfec28e80ee6bc046200eb.zip
meson-e33ec88ac714b1d41cbfec28e80ee6bc046200eb.tar.gz
meson-e33ec88ac714b1d41cbfec28e80ee6bc046200eb.tar.bz2
Pass environment down to base Target class
Diffstat (limited to 'mesonbuild/modules')
-rw-r--r--mesonbuild/modules/gnome.py25
-rw-r--r--mesonbuild/modules/hotdoc.py5
-rw-r--r--mesonbuild/modules/i18n.py12
-rw-r--r--mesonbuild/modules/java.py7
-rw-r--r--mesonbuild/modules/qt.py3
-rw-r--r--mesonbuild/modules/unstable_external_project.py1
-rw-r--r--mesonbuild/modules/unstable_rust.py1
-rw-r--r--mesonbuild/modules/unstable_wayland.py2
-rw-r--r--mesonbuild/modules/windows.py1
9 files changed, 47 insertions, 10 deletions
diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py
index 6acd15c..484938e 100644
--- a/mesonbuild/modules/gnome.py
+++ b/mesonbuild/modules/gnome.py
@@ -500,6 +500,7 @@ class GnomeModule(ExtensionModule):
name,
state.subdir,
state.subproject,
+ state.environment,
target_cmd,
[input_file],
[output],
@@ -520,6 +521,7 @@ class GnomeModule(ExtensionModule):
f'{target_name}_h',
state.subdir,
state.subproject,
+ state.environment,
cmd,
[input_file],
[f'{target_name}.h'],
@@ -967,6 +969,7 @@ class GnomeModule(ExtensionModule):
girfile,
state.subdir,
state.subproject,
+ state.environment,
scan_command,
generated_files,
[girfile],
@@ -996,6 +999,7 @@ class GnomeModule(ExtensionModule):
typelib_output,
state.subdir,
state.subproject,
+ state.environment,
typelib_cmd,
generated_files,
[typelib_output],
@@ -1220,6 +1224,7 @@ class GnomeModule(ExtensionModule):
targetname,
state.subdir,
state.subproject,
+ state.environment,
cmd,
[],
['gschemas.compiled'],
@@ -1292,7 +1297,8 @@ class GnomeModule(ExtensionModule):
pot_args: T.List[T.Union['ExternalProgram', str]] = [itstool, '-o', pot_file]
pot_args.extend(pot_sources)
pottarget = build.RunTarget(f'help-{project_id}-pot', pot_args, [],
- os.path.join(state.subdir, 'C'), state.subproject)
+ os.path.join(state.subdir, 'C'), state.subproject,
+ state.environment)
targets.append(pottarget)
for l in langs:
@@ -1322,7 +1328,8 @@ class GnomeModule(ExtensionModule):
os.path.join('@SOURCE_ROOT@', l_subdir, po_file),
os.path.join('@SOURCE_ROOT@', l_subdir, po_file), pot_file]
potarget = build.RunTarget(f'help-{project_id}-{l}-update-po',
- po_args, [pottarget], l_subdir, state.subproject)
+ po_args, [pottarget], l_subdir, state.subproject,
+ state.environment)
targets.append(potarget)
potargets.append(potarget)
@@ -1331,6 +1338,7 @@ class GnomeModule(ExtensionModule):
f'help-{project_id}-{l}-gmo',
l_subdir,
state.subproject,
+ state.environment,
[msgfmt, '@INPUT@', '-o', '@OUTPUT@'],
[po_file],
[gmo_file],
@@ -1341,6 +1349,7 @@ class GnomeModule(ExtensionModule):
f'help-{project_id}-{l}',
l_subdir,
state.subproject,
+ state.environment,
[itstool, '-m', os.path.join(l_subdir, gmo_file), '-o', '@OUTDIR@', '@INPUT@'],
sources_files,
sources,
@@ -1351,7 +1360,7 @@ class GnomeModule(ExtensionModule):
targets.append(mergetarget)
allpotarget = build.AliasTarget(f'help-{project_id}-update-po', potargets,
- state.subdir, state.subproject)
+ state.subdir, state.subproject, state.environment)
targets.append(allpotarget)
return ModuleReturnValue(None, targets)
@@ -1484,13 +1493,14 @@ class GnomeModule(ExtensionModule):
targetname,
state.subdir,
state.subproject,
+ state.environment,
command + t_args,
[],
[f'{modulename}-decl.txt'],
build_always_stale=True,
extra_depends=new_depends,
)
- alias_target = build.AliasTarget(targetname, [custom_target], state.subdir, state.subproject)
+ alias_target = build.AliasTarget(targetname, [custom_target], state.subdir, state.subproject, state.environment)
if kwargs['check']:
check_cmd = state.find_program('gtkdoc-check')
check_env = ['DOC_MODULE=' + modulename,
@@ -1627,6 +1637,7 @@ class GnomeModule(ExtensionModule):
output,
state.subdir,
state.subproject,
+ state.environment,
c_cmd,
xml_files,
[output],
@@ -1646,6 +1657,7 @@ class GnomeModule(ExtensionModule):
output,
state.subdir,
state.subproject,
+ state.environment,
hfile_cmd,
xml_files,
[output],
@@ -1675,6 +1687,7 @@ class GnomeModule(ExtensionModule):
output,
state.subdir,
state.subproject,
+ state.environment,
docbook_cmd,
xml_files,
outputs,
@@ -1891,6 +1904,7 @@ class GnomeModule(ExtensionModule):
output,
state.subdir,
state.subproject,
+ state.environment,
real_cmd,
sources,
[output],
@@ -1956,6 +1970,7 @@ class GnomeModule(ExtensionModule):
output + '_h',
state.subdir,
state.subproject,
+ state.environment,
h_cmd,
sources,
[header_file],
@@ -1975,6 +1990,7 @@ class GnomeModule(ExtensionModule):
output + '_c',
state.subdir,
state.subproject,
+ state.environment,
c_cmd,
sources,
[f'{output}.c'],
@@ -2099,6 +2115,7 @@ class GnomeModule(ExtensionModule):
vapi_output,
state.subdir,
state.subproject,
+ state.environment,
command=cmd,
sources=inputs,
outputs=[vapi_output],
diff --git a/mesonbuild/modules/hotdoc.py b/mesonbuild/modules/hotdoc.py
index bc88c5d..beb92b8 100644
--- a/mesonbuild/modules/hotdoc.py
+++ b/mesonbuild/modules/hotdoc.py
@@ -338,6 +338,7 @@ class HotdocTargetBuilder:
target = HotdocTarget(fullname,
subdir=self.subdir,
subproject=self.state.subproject,
+ environment=self.state.environment,
hotdoc_conf=mesonlib.File.from_built_file(
self.subdir, hotdoc_config_name),
extra_extension_paths=self._extra_extension_paths,
@@ -379,8 +380,8 @@ class HotdocTargetHolder(CustomTargetHolder):
class HotdocTarget(build.CustomTarget):
def __init__(self, name, subdir, subproject, hotdoc_conf, extra_extension_paths, extra_assets,
- subprojects, **kwargs):
- super().__init__(name, subdir, subproject, **kwargs, absolute_paths=True)
+ subprojects, environment, **kwargs):
+ super().__init__(name, subdir, subproject, environment, **kwargs, absolute_paths=True)
self.hotdoc_conf = hotdoc_conf
self.extra_extension_paths = extra_extension_paths
self.extra_assets = extra_assets
diff --git a/mesonbuild/modules/i18n.py b/mesonbuild/modules/i18n.py
index 09703bb..d388d3f 100644
--- a/mesonbuild/modules/i18n.py
+++ b/mesonbuild/modules/i18n.py
@@ -195,6 +195,7 @@ class I18nModule(ExtensionModule):
'',
state.subdir,
state.subproject,
+ state.environment,
command,
kwargs['input'],
kwargs['output'],
@@ -255,7 +256,8 @@ class I18nModule(ExtensionModule):
if extra_arg:
potargs.append(extra_arg)
potargs.append('--xgettext=' + self.tools['xgettext'].get_path())
- pottarget = build.RunTarget(packagename + '-pot', potargs, [], state.subdir, state.subproject)
+ pottarget = build.RunTarget(packagename + '-pot', potargs, [], state.subdir, state.subproject,
+ state.environment)
targets.append(pottarget)
install = kwargs['install']
@@ -270,6 +272,7 @@ class I18nModule(ExtensionModule):
f'{packagename}-{l}.mo',
path.join(state.subdir, l, 'LC_MESSAGES'),
state.subproject,
+ state.environment,
[self.tools['msgfmt'], '@INPUT@', '-o', '@OUTPUT@'],
[po_file],
[f'{packagename}.mo'],
@@ -284,7 +287,8 @@ class I18nModule(ExtensionModule):
targets.append(gmotarget)
gmotargets.append(gmotarget)
- allgmotarget = build.AliasTarget(packagename + '-gmo', gmotargets, state.subdir, state.subproject)
+ allgmotarget = build.AliasTarget(packagename + '-gmo', gmotargets, state.subdir, state.subproject,
+ state.environment)
targets.append(allgmotarget)
updatepoargs = state.environment.get_build_command() + ['--internal', 'gettext', 'update_po', pkg_arg]
@@ -296,7 +300,8 @@ class I18nModule(ExtensionModule):
updatepoargs.append(extra_arg)
for tool in ['msginit', 'msgmerge']:
updatepoargs.append(f'--{tool}=' + self.tools[tool].get_path())
- updatepotarget = build.RunTarget(packagename + '-update-po', updatepoargs, [], state.subdir, state.subproject)
+ updatepotarget = build.RunTarget(packagename + '-update-po', updatepoargs, [], state.subdir, state.subproject,
+ state.environment)
targets.append(updatepotarget)
return ModuleReturnValue([gmotargets, pottarget, updatepotarget], targets)
@@ -349,6 +354,7 @@ class I18nModule(ExtensionModule):
'',
state.subdir,
state.subproject,
+ state.environment,
command,
kwargs['input'],
kwargs['output'],
diff --git a/mesonbuild/modules/java.py b/mesonbuild/modules/java.py
index ddb14c8..22b8d2c 100644
--- a/mesonbuild/modules/java.py
+++ b/mesonbuild/modules/java.py
@@ -60,6 +60,7 @@ class JavaModule(NewExtensionModule):
os.path.basename(header),
state.subdir,
state.subproject,
+ state.environment,
mesonlib.listify([
javac.exelist,
'-d',
@@ -112,7 +113,11 @@ class JavaModule(NewExtensionModule):
prefix = classes[0] if not package else package
- target = CustomTarget(f'{prefix}-native-headers', state.subdir, state.subproject, command,
+ target = CustomTarget(f'{prefix}-native-headers',
+ state.subdir,
+ state.subproject,
+ state.environment,
+ command,
sources=args[0], outputs=headers, backend=state.backend)
# It is only known that 1.8.0 won't pre-create the directory. 11 and 16
diff --git a/mesonbuild/modules/qt.py b/mesonbuild/modules/qt.py
index bf6d30c..81dd3e9 100644
--- a/mesonbuild/modules/qt.py
+++ b/mesonbuild/modules/qt.py
@@ -332,6 +332,7 @@ class QtBaseModule(ExtensionModule):
name,
state.subdir,
state.subproject,
+ state.environment,
self.tools['rcc'].get_command() + ['-name', name, '-o', '@OUTPUT@'] + extra_args + ['@INPUT@'] + DEPFILE_ARGS,
sources,
[f'{name}.cpp'],
@@ -351,6 +352,7 @@ class QtBaseModule(ExtensionModule):
name,
state.subdir,
state.subproject,
+ state.environment,
self.tools['rcc'].get_command() + ['-name', '@BASENAME@', '-o', '@OUTPUT@'] + extra_args + ['@INPUT@'] + DEPFILE_ARGS,
[rcc_file],
[f'{name}.cpp'],
@@ -579,6 +581,7 @@ class QtBaseModule(ExtensionModule):
f'qt{self.qt_version}-compile-{ts}',
outdir,
state.subproject,
+ state.environment,
cmd,
[ts],
['@BASENAME@.qm'],
diff --git a/mesonbuild/modules/unstable_external_project.py b/mesonbuild/modules/unstable_external_project.py
index 11ae772..d2c5b22 100644
--- a/mesonbuild/modules/unstable_external_project.py
+++ b/mesonbuild/modules/unstable_external_project.py
@@ -231,6 +231,7 @@ class ExternalProject(NewExtensionModule):
self.name,
self.subdir.as_posix(),
self.subproject,
+ self.env,
cmd + ['@OUTPUT@', '@DEPFILE@'],
[],
[f'{self.name}.stamp'],
diff --git a/mesonbuild/modules/unstable_rust.py b/mesonbuild/modules/unstable_rust.py
index 4e3dde2..4d6718e 100644
--- a/mesonbuild/modules/unstable_rust.py
+++ b/mesonbuild/modules/unstable_rust.py
@@ -213,6 +213,7 @@ class RustModule(ExtensionModule):
f'rustmod-bindgen-{name}'.replace('/', '_'),
state.subdir,
state.subproject,
+ state.environment,
self._bindgen_bin.get_command() + [
'@INPUT@', '--output',
os.path.join(state.environment.build_dir, '@OUTPUT@')] +
diff --git a/mesonbuild/modules/unstable_wayland.py b/mesonbuild/modules/unstable_wayland.py
index a7653d9..c3e29f4 100644
--- a/mesonbuild/modules/unstable_wayland.py
+++ b/mesonbuild/modules/unstable_wayland.py
@@ -61,6 +61,7 @@ class WaylandModule(ExtensionModule):
f'{name}-protocol',
state.subdir,
state.subproject,
+ state.environment,
[self.scanner_bin, f'{scope}-code', '@INPUT@', '@OUTPUT@'],
[xml_file],
[f'{name}-protocol.c'],
@@ -73,6 +74,7 @@ class WaylandModule(ExtensionModule):
f'{name}-{side}-protocol',
state.subdir,
state.subproject,
+ state.environment,
[self.scanner_bin, f'{side}-header', '@INPUT@', '@OUTPUT@'],
[xml_file],
[f'{name}-{side}-protocol.h'],
diff --git a/mesonbuild/modules/windows.py b/mesonbuild/modules/windows.py
index eb07ced..0033fe9 100644
--- a/mesonbuild/modules/windows.py
+++ b/mesonbuild/modules/windows.py
@@ -193,6 +193,7 @@ class WindowsModule(ExtensionModule):
name_formatted,
state.subdir,
state.subproject,
+ state.environment,
command,
[src],
[output],