diff options
author | Alyssa Ross <hi@alyssa.is> | 2024-03-22 16:41:59 +0100 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2024-03-22 16:41:59 +0100 |
commit | 46a88117a05c3469af5d99433af140c3de8ca088 (patch) | |
tree | d7f0557756d8f07a3081b3498c05ddc5a8ad429d /nixpkgs/pkgs/development/compilers/rust/cargo.nix | |
parent | e97457545cea0b2ca421da257c83d8f1ef451d85 (diff) | |
parent | a343533bccc62400e8a9560423486a3b6c11a23b (diff) | |
download | nixlib-46a88117a05c3469af5d99433af140c3de8ca088.tar nixlib-46a88117a05c3469af5d99433af140c3de8ca088.tar.gz nixlib-46a88117a05c3469af5d99433af140c3de8ca088.tar.bz2 nixlib-46a88117a05c3469af5d99433af140c3de8ca088.tar.lz nixlib-46a88117a05c3469af5d99433af140c3de8ca088.tar.xz nixlib-46a88117a05c3469af5d99433af140c3de8ca088.tar.zst nixlib-46a88117a05c3469af5d99433af140c3de8ca088.zip |
Merge commit 'a343533bccc62400e8a9560423486a3b6c11a23b'
Diffstat (limited to 'nixpkgs/pkgs/development/compilers/rust/cargo.nix')
-rw-r--r-- | nixpkgs/pkgs/development/compilers/rust/cargo.nix | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/nixpkgs/pkgs/development/compilers/rust/cargo.nix b/nixpkgs/pkgs/development/compilers/rust/cargo.nix index 1377cfad6c6c..b57ad0c811c2 100644 --- a/nixpkgs/pkgs/development/compilers/rust/cargo.nix +++ b/nixpkgs/pkgs/development/compilers/rust/cargo.nix @@ -24,42 +24,6 @@ rustPlatform.buildRustPackage.override { inherit (rustc.unwrapped) tests; }; - # Upstream rustc still assumes that musl = static[1]. The fix for - # this is to disable crt-static by default for non-static musl - # targets. - # - # For every package apart from Cargo, we can fix this by just - # patching rustc to not have crt-static by default. But Cargo is - # built with the upstream bootstrap binary for rustc, which we can't - # easily patch. This means we need to find another way to make sure - # crt-static is not used during the build of pkgsMusl.cargo. - # - # By default, Cargo doesn't apply RUSTFLAGS when building build.rs - # if --target is passed, so the only good way to set -crt-static for - # build.rs files used in the Cargo build is to use the unstable - # -Zhost-config Cargo feature. This allows us to specify flags that - # should be passed to rustc when building for the build platform. - # We also need to use -Ztarget-applies-to-host, because using - # -Zhost-config requires it. - # - # When doing this, we also have to specify the linker, or cargo - # won't pass a -C linker= argument to rustc. This will make rustc - # try to use its default value of "cc", which won't be available - # when cross-compiling. - # - # [1]: https://github.com/rust-lang/compiler-team/issues/422 - postPatch = lib.optionalString (with stdenv.buildPlatform; isMusl && !isStatic) '' - mkdir -p .cargo - cat <<EOF >> .cargo/config - [host] - rustflags = "-C target-feature=-crt-static" - linker = "${pkgsBuildHost.stdenv.cc}/bin/${pkgsBuildHost.stdenv.cc.targetPrefix}cc" - [unstable] - host-config = true - target-applies-to-host = true - EOF - ''; - # changes hash of vendor directory otherwise dontUpdateAutotoolsGnuConfigScripts = true; |