buildRustCrate: prevent pulling in two rustc variants
With the addition of `remap-path-prefix` to buildRustCrate, we now can pull in two rustc variants when cross compiling, since the rustc that is string-interpolated for passing the remap flag is not pulled from the proper package-set. Depending on the host platform used, this rustc variant may not even build. In order to only pull in one variant, and to properly mask the rustc used for building with the remap-path-prefix flag, rustc is passed explicitly from pkgsBuildHost.
This commit is contained in:
@@ -155,8 +155,6 @@ crate_:
|
||||
lib.makeOverridable
|
||||
(
|
||||
# The rust compiler to use.
|
||||
#
|
||||
# Default: pkgs.rustc
|
||||
{
|
||||
rust ? rustc,
|
||||
# The cargo package to use for getting some metadata.
|
||||
|
||||
@@ -4401,11 +4401,20 @@ with pkgs;
|
||||
);
|
||||
in
|
||||
callPackage ../build-support/rust/build-rust-crate (
|
||||
{ }
|
||||
// lib.optionalAttrs (stdenv.hostPlatform.libc == null) {
|
||||
lib.optionalAttrs (stdenv.hostPlatform.libc == null) {
|
||||
stdenv = stdenvNoCC; # Some build targets without libc will fail to evaluate with a normal stdenv.
|
||||
}
|
||||
// lib.optionalAttrs targetAlreadyIncluded { inherit (pkgsBuildBuild) rustc cargo; } # Optimization.
|
||||
// (
|
||||
if targetAlreadyIncluded then
|
||||
# Optimization
|
||||
{
|
||||
inherit (pkgsBuildBuild) rustc cargo;
|
||||
}
|
||||
else
|
||||
{
|
||||
inherit (pkgsBuildHost) rustc cargo;
|
||||
}
|
||||
)
|
||||
);
|
||||
buildRustCrateHelpers = callPackage ../build-support/rust/build-rust-crate/helpers.nix { };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user