diff options
-rw-r--r-- | pkgs/build-support/rust/rustc-wrapper/default.nix | 3 | ||||
-rw-r--r-- | pkgs/build-support/rust/rustc-wrapper/rustc-wrapper.sh | 9 | ||||
-rw-r--r-- | pkgs/development/compilers/rust/1_74.nix | 2 | ||||
-rw-r--r-- | pkgs/development/compilers/rust/default.nix | 7 | ||||
-rw-r--r-- | pkgs/development/compilers/rust/rustc.nix | 2 |
5 files changed, 16 insertions, 7 deletions
diff --git a/pkgs/build-support/rust/rustc-wrapper/default.nix b/pkgs/build-support/rust/rustc-wrapper/default.nix index 06cfcbb5457f..d6034c08af47 100644 --- a/pkgs/build-support/rust/rustc-wrapper/default.nix +++ b/pkgs/build-support/rust/rustc-wrapper/default.nix @@ -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 = { diff --git a/pkgs/build-support/rust/rustc-wrapper/rustc-wrapper.sh b/pkgs/build-support/rust/rustc-wrapper/rustc-wrapper.sh index 866a6912e090..a62e35b8736f 100644 --- a/pkgs/build-support/rust/rustc-wrapper/rustc-wrapper.sh +++ b/pkgs/build-support/rust/rustc-wrapper/rustc-wrapper.sh @@ -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[@]}" diff --git a/pkgs/development/compilers/rust/1_74.nix b/pkgs/development/compilers/rust/1_74.nix index f8749a8b65c2..163c64c249b7 100644 --- a/pkgs/development/compilers/rust/1_74.nix +++ b/pkgs/development/compilers/rust/1_74.nix @@ -16,7 +16,7 @@ , CoreFoundation, Security, SystemConfiguration , pkgsBuildTarget, pkgsBuildBuild, pkgsBuildHost , makeRustPlatform -, wrapRustc +, wrapRustcWith , llvmPackages_16, llvm_16 } @ args: diff --git a/pkgs/development/compilers/rust/default.nix b/pkgs/development/compilers/rust/default.nix index b70b7ccf6264..d56b6fb9e08e 100644 --- a/pkgs/development/compilers/rust/default.nix +++ b/pkgs/development/compilers/rust/default.nix @@ -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; diff --git a/pkgs/development/compilers/rust/rustc.nix b/pkgs/development/compilers/rust/rustc.nix index cb74ec11127f..7e365f52ef30 100644 --- a/pkgs/development/compilers/rust/rustc.nix +++ b/pkgs/development/compilers/rust/rustc.nix @@ -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 |