rustc: use the wrapper for fastCross sysroot
This avoids having two layers of wrapper for cross rustc.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
{ lib, runCommand, rustc-unwrapped }:
|
||||
{ lib, runCommand, rustc-unwrapped, sysroot ? null }:
|
||||
|
||||
runCommand "${rustc-unwrapped.pname}-wrapper-${rustc-unwrapped.version}" {
|
||||
preferLocalBuild = true;
|
||||
@@ -7,6 +7,7 @@ runCommand "${rustc-unwrapped.pname}-wrapper-${rustc-unwrapped.version}" {
|
||||
|
||||
env = {
|
||||
prog = "${rustc-unwrapped}/bin/rustc";
|
||||
sysroot = lib.optionalString (sysroot != null) "--sysroot ${sysroot}";
|
||||
};
|
||||
|
||||
passthru = {
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
#!@shell@
|
||||
|
||||
extraBefore=(@sysroot@)
|
||||
extraAfter=($NIX_RUSTFLAGS)
|
||||
|
||||
# Optionally print debug info.
|
||||
if (( "${NIX_DEBUG:-0}" >= 1 )); then
|
||||
echo "extra flags before to @prog@:" >&2
|
||||
printf " %q\n" "${extraBefore[@]}" >&2
|
||||
echo "original flags to @prog@:" >&2
|
||||
printf " %q\n" "$@" >&2
|
||||
echo "extra flags after to @prog@:" >&2
|
||||
printf " %q\n" $NIX_RUSTFLAGS >&2
|
||||
printf " %q\n" "${extraAfter[@]}" >&2
|
||||
fi
|
||||
|
||||
exec @prog@ "$@" $NIX_RUSTFLAGS
|
||||
exec @prog@ "${extraBefore[@]}" "$@" "${extraAfter[@]}"
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
, CoreFoundation, Security, SystemConfiguration
|
||||
, pkgsBuildTarget, pkgsBuildBuild, pkgsBuildHost
|
||||
, makeRustPlatform
|
||||
, wrapRustc
|
||||
, wrapRustcWith
|
||||
, llvmPackages_16, llvm_16
|
||||
} @ args:
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
, CoreFoundation, Security, SystemConfiguration
|
||||
, pkgsBuildBuild
|
||||
, makeRustPlatform
|
||||
, wrapRustc
|
||||
, wrapRustcWith
|
||||
}:
|
||||
|
||||
let
|
||||
@@ -76,7 +76,10 @@ in
|
||||
# Use boot package set to break cycle
|
||||
inherit (bootstrapRustPackages) cargo rustc rustfmt;
|
||||
});
|
||||
rustc = wrapRustc self.rustc-unwrapped;
|
||||
rustc = wrapRustcWith {
|
||||
inherit (self) rustc-unwrapped;
|
||||
sysroot = if fastCross then self.rustc-unwrapped else null;
|
||||
};
|
||||
rustfmt = self.callPackage ./rustfmt.nix {
|
||||
inherit Security;
|
||||
inherit (self.buildRustPackages) rustc;
|
||||
|
||||
@@ -169,7 +169,7 @@ in stdenv.mkDerivation (finalAttrs: {
|
||||
|
||||
python ./x.py --keep-stage=0 --stage=1 install library/std
|
||||
mkdir -v $out/bin $doc $man
|
||||
makeWrapper ${rustc.unwrapped}/bin/rustc $out/bin/rustc --add-flags "--sysroot $out"
|
||||
ln -s ${rustc.unwrapped}/bin/rustc $out/bin
|
||||
makeWrapper ${rustc.unwrapped}/bin/rustdoc $out/bin/rustdoc --add-flags "--sysroot $out"
|
||||
ln -s ${rustc.unwrapped}/lib/rustlib/{manifest-rust-std-,}${stdenv.hostPlatform.rust.rustcTargetSpec} $out/lib/rustlib/
|
||||
echo rust-std-${stdenv.hostPlatform.rust.rustcTargetSpec} >> $out/lib/rustlib/components
|
||||
|
||||
Reference in New Issue
Block a user