Skip to content

Commit

Permalink
cargo: Use the library name instead of package name
Browse files Browse the repository at this point in the history
The library name defaults to its package name, but it can be different.
For example:
- package name: cairo-sys-rs
- library name: cairo-sys
- dependency name: ffi
  • Loading branch information
xclaesse committed Mar 10, 2024
1 parent 91329a2 commit 0ca3969
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions mesonbuild/cargo/interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -643,8 +643,10 @@ def _create_lib(self, pkg: PackageState, build: builder.Builder, crate_type: man
for name in pkg.required_deps:
dep = pkg.manifest.dependencies[name]
dependencies.append(build.identifier(_dependency_varname(dep.package)))
if name != dep.package:
dependency_map[build.string(fixup_meson_varname(dep.package))] = build.string(name)
dep_pkg = self._dep_package(dep)
dep_lib_name = dep_pkg.manifest.lib.name
if name != dep_lib_name:
dependency_map[build.string(fixup_meson_varname(dep_lib_name))] = build.string(name)

rust_args: T.List[mparser.BaseNode] = [
build.identifier('features_args'),
Expand All @@ -654,7 +656,7 @@ def _create_lib(self, pkg: PackageState, build: builder.Builder, crate_type: man
dependencies.append(build.identifier(_extra_deps_varname()))

posargs: T.List[mparser.BaseNode] = [
build.string(fixup_meson_varname(pkg.manifest.package.name)),
build.string(fixup_meson_varname(pkg.manifest.lib.name)),
build.string(pkg.manifest.lib.path),
]

Expand Down

0 comments on commit 0ca3969

Please sign in to comment.