mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 08:23:09 +00:00
Revert "rust: allow linker to be different from compiler"
This reverts commit b8076b893e
.
This commit is contained in:
parent
351899cd4b
commit
88c41d8a91
@ -66,10 +66,10 @@
|
||||
|
||||
cargoConfig = ''
|
||||
[target."${stdenv.buildPlatform.rust.rustcTarget}"]
|
||||
"linker" = "${rust.envVars.linkerForBuild}"
|
||||
"linker" = "${rust.envVars.ccForBuild}"
|
||||
${lib.optionalString (stdenv.buildPlatform.config != stdenv.hostPlatform.config) ''
|
||||
[target."${stdenv.hostPlatform.rust.rustcTarget}"]
|
||||
"linker" = "${rust.envVars.linkerForHost}"
|
||||
"linker" = "${rust.envVars.ccForHost}"
|
||||
''}
|
||||
"rustflags" = [ "-C", "target-feature=${if stdenv.hostPlatform.isStatic then "+" else "-"}crt-static" ]
|
||||
'';
|
||||
|
@ -16,11 +16,9 @@ rec {
|
||||
|
||||
ccForBuild = "${pkgsBuildHost.stdenv.cc}/bin/${pkgsBuildHost.stdenv.cc.targetPrefix}cc";
|
||||
cxxForBuild = "${pkgsBuildHost.stdenv.cc}/bin/${pkgsBuildHost.stdenv.cc.targetPrefix}c++";
|
||||
linkerForBuild = ccForBuild;
|
||||
|
||||
ccForHost = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc";
|
||||
cxxForHost = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++";
|
||||
linkerForHost = ccForHost;
|
||||
|
||||
# Unfortunately we must use the dangerous `pkgsTargetTarget` here
|
||||
# because hooks are artificially phase-shifted one slot earlier
|
||||
@ -28,7 +26,6 @@ rec {
|
||||
# a targetPlatform to them).
|
||||
ccForTarget = "${pkgsTargetTarget.stdenv.cc}/bin/${pkgsTargetTarget.stdenv.cc.targetPrefix}cc";
|
||||
cxxForTarget = "${pkgsTargetTarget.stdenv.cc}/bin/${pkgsTargetTarget.stdenv.cc.targetPrefix}c++";
|
||||
linkerForTarget = ccForTarget;
|
||||
|
||||
rustBuildPlatform = stdenv.buildPlatform.rust.rustcTarget;
|
||||
rustBuildPlatformSpec = stdenv.buildPlatform.rust.rustcTargetSpec;
|
||||
@ -38,9 +35,9 @@ rec {
|
||||
rustTargetPlatformSpec = stdenv.targetPlatform.rust.rustcTargetSpec;
|
||||
in {
|
||||
inherit
|
||||
ccForBuild cxxForBuild linkerForBuild rustBuildPlatform rustBuildPlatformSpec
|
||||
ccForHost cxxForHost linkerForHost rustHostPlatform rustHostPlatformSpec
|
||||
ccForTarget cxxForTarget linkerForTarget rustTargetPlatform rustTargetPlatformSpec;
|
||||
ccForBuild cxxForBuild rustBuildPlatform rustBuildPlatformSpec
|
||||
ccForHost cxxForHost rustHostPlatform rustHostPlatformSpec
|
||||
ccForTarget cxxForTarget rustTargetPlatform rustTargetPlatformSpec;
|
||||
|
||||
# Prefix this onto a command invocation in order to set the
|
||||
# variables needed by cargo.
|
||||
@ -56,15 +53,15 @@ rec {
|
||||
+ lib.optionalString (rustTargetPlatform != rustHostPlatform) ''
|
||||
"CC_${stdenv.targetPlatform.rust.cargoEnvVarTarget}=${ccForTarget}" \
|
||||
"CXX_${stdenv.targetPlatform.rust.cargoEnvVarTarget}=${cxxForTarget}" \
|
||||
"CARGO_TARGET_${stdenv.targetPlatform.rust.cargoEnvVarTarget}_LINKER=${linkerForTarget}" \
|
||||
"CARGO_TARGET_${stdenv.targetPlatform.rust.cargoEnvVarTarget}_LINKER=${ccForTarget}" \
|
||||
'' + ''
|
||||
"CC_${stdenv.hostPlatform.rust.cargoEnvVarTarget}=${ccForHost}" \
|
||||
"CXX_${stdenv.hostPlatform.rust.cargoEnvVarTarget}=${cxxForHost}" \
|
||||
"CARGO_TARGET_${stdenv.hostPlatform.rust.cargoEnvVarTarget}_LINKER=${linkerForHost}" \
|
||||
"CARGO_TARGET_${stdenv.hostPlatform.rust.cargoEnvVarTarget}_LINKER=${ccForHost}" \
|
||||
'' + ''
|
||||
"CC_${stdenv.buildPlatform.rust.cargoEnvVarTarget}=${ccForBuild}" \
|
||||
"CXX_${stdenv.buildPlatform.rust.cargoEnvVarTarget}=${cxxForBuild}" \
|
||||
"CARGO_TARGET_${stdenv.buildPlatform.rust.cargoEnvVarTarget}_LINKER=${linkerForBuild}" \
|
||||
"CARGO_TARGET_${stdenv.buildPlatform.rust.cargoEnvVarTarget}_LINKER=${ccForBuild}" \
|
||||
"CARGO_BUILD_TARGET=${rustBuildPlatform}" \
|
||||
"HOST_CC=${pkgsBuildHost.stdenv.cc}/bin/cc" \
|
||||
"HOST_CXX=${pkgsBuildHost.stdenv.cc}/bin/c++" \
|
||||
|
Loading…
Reference in New Issue
Block a user