forked from NixOS/nixpkgs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
buildRustCrate: add support for renaming crates
Before this change, buildRustCrate always called rustc with --extern libName=[...]libName[...] However, Cargo permits using a different name under which a dependency is known to a crate. For example, rand 0.7.0 uses: [dependencies] getrandom_package = { version = "0.1.1", package = "getrandom", optional = true } Which introduces the getrandom dependency such that it is known as getrandom_package to the rand crate. In this case, the correct extern flag is of the form --extern getrandom_package=[...]getrandom[...] which is currently not supported. In order to support such cases, this change introduces a crateRenames argument to buildRustCrate. This argument is an attribute set of dependencies that should be renamed. In this case, crateRenames would be: { "getrandom" = "getrandom_package"; } The extern options are then built such that if the libName occurs as an attribute in this set, it value will be used as the local name. Otherwise libName will be used as before.
- Loading branch information
Showing
4 changed files
with
39 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters