summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2025-10-26 10:32:36 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2025-12-22 12:01:05 +0100
commitb612ba31923db30d079d184791dcd799c01529e7 (patch)
tree1cd5169c658bad369a05fceb9871cb3895b5a12e
parent254d7e1c48f3a2d0837439f07628cfd54e47367b (diff)
downloadmeson-b612ba31923db30d079d184791dcd799c01529e7.tar.gz
cargo: use rust.to_system_dependency
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--mesonbuild/cargo/interpreter.py27
1 files changed, 10 insertions, 17 deletions
diff --git a/mesonbuild/cargo/interpreter.py b/mesonbuild/cargo/interpreter.py
index dc5cdef2a..9ade9a824 100644
--- a/mesonbuild/cargo/interpreter.py
+++ b/mesonbuild/cargo/interpreter.py
@@ -706,7 +706,6 @@ class Interpreter:
dep_pkg = self._dep_package(pkg, dep)
if dep_pkg.manifest.lib:
ast += self._create_dependency(dep_pkg, dep, build)
- ast.append(build.assign(build.array([]), 'system_deps_args'))
for name, sys_dep in pkg.manifest.system_dependencies.items():
if sys_dep.enabled(cfg.features):
ast += self._create_system_dependency(name, sys_dep, build)
@@ -719,24 +718,20 @@ class Interpreter:
'required': build.bool(not dep.optional),
}
varname = f'{fixup_meson_varname(name)}_system_dep'
- cfg = f'system_deps_have_{fixup_meson_varname(name)}'
return [
build.assign(
- build.function(
- 'dependency',
- [build.string(dep.name)],
- kw,
- ),
+ build.method(
+ 'to_system_dependency',
+ build.identifier('rust'), [
+ build.function(
+ 'dependency',
+ [build.string(dep.name)],
+ kw,
+ ),
+ build.string(name)
+ ]),
varname,
),
- build.if_(
- build.method('found', build.identifier(varname)), build.block([
- build.plusassign(
- build.array([build.string('--cfg'), build.string(cfg)]),
- 'system_deps_args'
- ),
- ])
- ),
]
def _create_dependency(self, pkg: PackageState, dep: Dependency, build: builder.Builder) -> T.List[mparser.BaseNode]:
@@ -845,10 +840,8 @@ class Interpreter:
rustc_args_list = pkg.get_rustc_args(self.environment, subdir, MachineChoice.HOST)
extra_args_ref = build.identifier(_extra_args_varname())
- system_deps_args_ref = build.identifier('system_deps_args')
rust_args: T.List[mparser.BaseNode] = [build.string(a) for a in rustc_args_list]
rust_args.append(extra_args_ref)
- rust_args.append(system_deps_args_ref)
dependencies.append(build.identifier(_extra_deps_varname()))