Merge branch 'master' into staging
This commit is contained in:
@@ -6,12 +6,32 @@
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (stdenv.lib) optionalString;
|
||||
|
||||
needsPatchelf = stdenv.isLinux;
|
||||
inherit (stdenv.lib) getLib optionalString;
|
||||
inherit (darwin) libiconv;
|
||||
inherit (darwin.apple_sdk.frameworks) Security;
|
||||
|
||||
bootstrapping = versionType == "bootstrap";
|
||||
|
||||
patchBootstrapCargo = ''
|
||||
${optionalString (stdenv.isLinux && bootstrapping) ''
|
||||
patchelf \
|
||||
--set-rpath "${stdenv.lib.makeLibraryPath [ curl zlib ]}" \
|
||||
--set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
|
||||
"$out/bin/cargo"
|
||||
''}
|
||||
${optionalString (stdenv.isDarwin && bootstrapping) ''
|
||||
install_name_tool \
|
||||
-change /usr/lib/libiconv.2.dylib '${getLib libiconv}/lib/libiconv.2.dylib' \
|
||||
"$out/bin/cargo"
|
||||
install_name_tool \
|
||||
-change /usr/lib/libcurl.4.dylib '${getLib curl}/lib/libcurl.4.dylib' \
|
||||
"$out/bin/cargo"
|
||||
install_name_tool \
|
||||
-change /usr/lib/libz.1.dylib '${getLib zlib}/lib/libz.1.dylib' \
|
||||
"$out/bin/cargo"
|
||||
''}
|
||||
'';
|
||||
|
||||
installComponents
|
||||
= "rustc,rust-std-${platform}"
|
||||
+ (optionalString bootstrapping ",rust-docs,cargo")
|
||||
@@ -34,22 +54,21 @@ rec {
|
||||
license = [ licenses.mit licenses.asl20 ];
|
||||
};
|
||||
|
||||
phases = ["unpackPhase" "installPhase"];
|
||||
phases = ["unpackPhase" "installPhase" "fixupPhase"];
|
||||
|
||||
propagatedBuildInputs = stdenv.lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.Security;
|
||||
propagatedBuildInputs = stdenv.lib.optional stdenv.isDarwin Security;
|
||||
|
||||
installPhase = ''
|
||||
./install.sh --prefix=$out \
|
||||
--components=${installComponents}
|
||||
|
||||
${optionalString (needsPatchelf && bootstrapping) ''
|
||||
${optionalString (stdenv.isLinux && bootstrapping) ''
|
||||
patchelf \
|
||||
--set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
|
||||
"$out/bin/rustc"
|
||||
patchelf \
|
||||
--set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
|
||||
"$out/bin/rustdoc"
|
||||
patchelf \
|
||||
--set-rpath "${stdenv.lib.makeLibraryPath [ curl zlib ]}" \
|
||||
--set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
|
||||
"$out/bin/cargo"
|
||||
''}
|
||||
${optionalString (stdenv.isDarwin && bootstrapping) ''
|
||||
install_name_tool -change /usr/lib/libiconv.2.dylib '${darwin.libiconv}/lib/libiconv.2.dylib' "$out/bin/cargo"
|
||||
@@ -57,19 +76,14 @@ rec {
|
||||
install_name_tool -change /usr/lib/libz.1.dylib '${stdenv.lib.getLib zlib}/lib/libz.1.dylib' "$out/bin/cargo"
|
||||
''}
|
||||
|
||||
${optionalString needsPatchelf ''
|
||||
patchelf \
|
||||
--set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
|
||||
"$out/bin/rustc"
|
||||
${patchBootstrapCargo}
|
||||
|
||||
# Do NOT, I repeat, DO NOT use `wrapProgram` on $out/bin/rustc
|
||||
# (or similar) here. It causes strange effects where rustc loads
|
||||
# the wrong libraries in a bootstrap-build causing failures that
|
||||
# are very hard to track dow. For details, see
|
||||
# https://github.com/rust-lang/rust/issues/34722#issuecomment-232164943
|
||||
''}
|
||||
'';
|
||||
|
||||
};
|
||||
|
||||
cargo = stdenv.mkDerivation rec {
|
||||
@@ -85,19 +99,16 @@ rec {
|
||||
license = [ licenses.mit licenses.asl20 ];
|
||||
};
|
||||
|
||||
phases = ["unpackPhase" "installPhase" "fixupPhase"];
|
||||
|
||||
buildInputs = [ makeWrapper ];
|
||||
phases = ["unpackPhase" "installPhase"];
|
||||
propagatedBuildInputs = stdenv.lib.optional stdenv.isDarwin Security;
|
||||
|
||||
installPhase = ''
|
||||
./install.sh --prefix=$out \
|
||||
--components=cargo
|
||||
|
||||
${optionalString needsPatchelf ''
|
||||
patchelf \
|
||||
--set-rpath "${stdenv.lib.makeLibraryPath [ curl zlib ]}" \
|
||||
--set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
|
||||
"$out/bin/cargo"
|
||||
''}
|
||||
${patchBootstrapCargo}
|
||||
|
||||
wrapProgram "$out/bin/cargo" \
|
||||
--suffix PATH : "${rustc}/bin"
|
||||
|
||||
Reference in New Issue
Block a user