From 8929ba838fa34da64f1490a4f47209d20c9346be Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Thu, 16 Nov 2023 12:19:36 +0100 Subject: rustc: use the wrapper for fastCross sysroot This avoids having two layers of wrapper for cross rustc. --- pkgs/build-support/rust/rustc-wrapper/default.nix | 3 ++- pkgs/build-support/rust/rustc-wrapper/rustc-wrapper.sh | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'pkgs/build-support/rust') 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[@]}" -- cgit 1.4.1