diff options
author | Alyssa Ross <hi@alyssa.is> | 2024-03-02 13:03:26 +0100 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2024-03-02 13:09:07 +0100 |
commit | 6f8fa05acf5e6f6b4926631de2a9a8b8b544f30d (patch) | |
tree | 9231f9e4077aded864fd856670ab5edc6d45d4b2 /pkgs/build-support/rust | |
parent | 18bc3c64e66d0fd2bb4b4fbfbc8e9b80e4c58734 (diff) | |
download | nixlib-6f8fa05acf5e6f6b4926631de2a9a8b8b544f30d.tar nixlib-6f8fa05acf5e6f6b4926631de2a9a8b8b544f30d.tar.gz nixlib-6f8fa05acf5e6f6b4926631de2a9a8b8b544f30d.tar.bz2 nixlib-6f8fa05acf5e6f6b4926631de2a9a8b8b544f30d.tar.lz nixlib-6f8fa05acf5e6f6b4926631de2a9a8b8b544f30d.tar.xz nixlib-6f8fa05acf5e6f6b4926631de2a9a8b8b544f30d.tar.zst nixlib-6f8fa05acf5e6f6b4926631de2a9a8b8b544f30d.zip |
wrapRustc: wrap rustdoc
We need to set -crt-static on musl for rustdoc as well, so let's unify the wrappers. Ideally, rather than wrapping rustdoc, we'd have rustdoc use the wrapped rustc, but that's currently only possible with an unstable option (--test-builder). The options set by the wrapper, -C target-feature and --sysroot, are supported by both rustdoc and rustc, but other flags maybe not be supported by both, so I've introduced different environment variables (the existing NIX_RUSTFLAGS and a new NIX_RUSTDOCFLAGS) to allow those to be set independently. This fixes cargo-auditable in pkgsMusl., which broke because its doctests stopped working when -crt-static was moved to the wrapper. Fixes: 79156bf13ae7 ("rustc: move crt-static default override to wrapper (#291829)")
Diffstat (limited to 'pkgs/build-support/rust')
-rw-r--r-- | pkgs/build-support/rust/rustc-wrapper/default.nix | 10 | ||||
-rw-r--r-- | pkgs/build-support/rust/rustc-wrapper/rustc-wrapper.sh | 2 |
2 files changed, 7 insertions, 5 deletions
diff --git a/pkgs/build-support/rust/rustc-wrapper/default.nix b/pkgs/build-support/rust/rustc-wrapper/default.nix index 2b4a84e72b24..0defa6355029 100644 --- a/pkgs/build-support/rust/rustc-wrapper/default.nix +++ b/pkgs/build-support/rust/rustc-wrapper/default.nix @@ -6,7 +6,6 @@ runCommand "${rustc-unwrapped.pname}-wrapper-${rustc-unwrapped.version}" { inherit (rustc-unwrapped) outputs; env = { - prog = "${rustc-unwrapped}/bin/rustc"; sysroot = lib.optionalString (sysroot != null) "--sysroot ${sysroot}"; # Upstream rustc still assumes that musl = static[1]. The fix for @@ -42,9 +41,12 @@ runCommand "${rustc-unwrapped.pname}-wrapper-${rustc-unwrapped.version}" { } '' mkdir -p $out/bin ln -s ${rustc-unwrapped}/bin/* $out/bin - rm $out/bin/rustc - substituteAll ${./rustc-wrapper.sh} $out/bin/rustc - chmod +x $out/bin/rustc + rm $out/bin/{rustc,rustdoc} + prog=${rustc-unwrapped}/bin/rustc extraFlagsVar=NIX_RUSTFLAGS \ + substituteAll ${./rustc-wrapper.sh} $out/bin/rustc + prog=${rustc-unwrapped}/bin/rustdoc extraFlagsVar=NIX_RUSTDOCFLAGS \ + substituteAll ${./rustc-wrapper.sh} $out/bin/rustdoc + chmod +x $out/bin/{rustc,rustdoc} ${lib.concatMapStrings (output: "ln -s ${rustc-unwrapped.${output}} \$${output}\n") (lib.remove "out" rustc-unwrapped.outputs)} '' diff --git a/pkgs/build-support/rust/rustc-wrapper/rustc-wrapper.sh b/pkgs/build-support/rust/rustc-wrapper/rustc-wrapper.sh index 63e18be2e131..e33cc3e2a025 100644 --- a/pkgs/build-support/rust/rustc-wrapper/rustc-wrapper.sh +++ b/pkgs/build-support/rust/rustc-wrapper/rustc-wrapper.sh @@ -14,7 +14,7 @@ for arg; do done extraBefore=(@defaultArgs@ "${defaultSysroot[@]}") -extraAfter=($NIX_RUSTFLAGS) +extraAfter=($@extraFlagsVar@) # Optionally print debug info. if (( "${NIX_DEBUG:-0}" >= 1 )); then |