diff options
author | Alyssa Ross <hi@alyssa.is> | 2023-11-16 12:19:36 +0100 |
---|---|---|
committer | Adam Joseph <54836058+amjoseph-nixpkgs@users.noreply.github.com> | 2023-11-30 09:23:06 +0000 |
commit | 8929ba838fa34da64f1490a4f47209d20c9346be (patch) | |
tree | f329df1105dddf7260e423c54f2354ed8cae772d /pkgs/build-support/rust | |
parent | 8b51cdd3bea18e806e3ed63add8e19292dfc84ec (diff) | |
download | nixlib-8929ba838fa34da64f1490a4f47209d20c9346be.tar nixlib-8929ba838fa34da64f1490a4f47209d20c9346be.tar.gz nixlib-8929ba838fa34da64f1490a4f47209d20c9346be.tar.bz2 nixlib-8929ba838fa34da64f1490a4f47209d20c9346be.tar.lz nixlib-8929ba838fa34da64f1490a4f47209d20c9346be.tar.xz nixlib-8929ba838fa34da64f1490a4f47209d20c9346be.tar.zst nixlib-8929ba838fa34da64f1490a4f47209d20c9346be.zip |
rustc: use the wrapper for fastCross sysroot
This avoids having two layers of wrapper for cross rustc.
Diffstat (limited to 'pkgs/build-support/rust')
-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 |
2 files changed, 9 insertions, 3 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[@]}" |