diff options
-rw-r--r-- | pkgs/development/compilers/rust/binaryBuild.nix | 50 | ||||
-rw-r--r-- | pkgs/development/compilers/rust/rustc.nix | 3 |
2 files changed, 25 insertions, 28 deletions
diff --git a/pkgs/development/compilers/rust/binaryBuild.nix b/pkgs/development/compilers/rust/binaryBuild.nix index 8dfe26f72f4ad..c8af0d979e228 100644 --- a/pkgs/development/compilers/rust/binaryBuild.nix +++ b/pkgs/development/compilers/rust/binaryBuild.nix @@ -12,26 +12,6 @@ let 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") @@ -56,7 +36,7 @@ rec { phases = ["unpackPhase" "installPhase" "fixupPhase"]; - propagatedBuildInputs = stdenv.lib.optional stdenv.isDarwin Security; + buildInputs = stdenv.lib.optional stdenv.isDarwin Security; installPhase = '' ./install.sh --prefix=$out \ @@ -69,15 +49,22 @@ rec { patchelf \ --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ "$out/bin/rustdoc" + patchelf \ + --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ + "$out/bin/cargo" ''} + ${optionalString (stdenv.isDarwin && bootstrapping) '' + install_name_tool -change /usr/lib/libresolv.9.dylib '${darwin.libresolv}/lib/libresolv.9.dylib' "$out/bin/rustc" + install_name_tool -change /usr/lib/libresolv.9.dylib '${darwin.libresolv}/lib/libresolv.9.dylib' "$out/bin/rustdoc" install_name_tool -change /usr/lib/libiconv.2.dylib '${darwin.libiconv}/lib/libiconv.2.dylib' "$out/bin/cargo" + install_name_tool -change /usr/lib/libresolv.9.dylib '${darwin.libresolv}/lib/libresolv.9.dylib' "$out/bin/cargo" install_name_tool -change /usr/lib/libcurl.4.dylib '${stdenv.lib.getLib curl}/lib/libcurl.4.dylib' "$out/bin/cargo" - install_name_tool -change /usr/lib/libz.1.dylib '${stdenv.lib.getLib zlib}/lib/libz.1.dylib' "$out/bin/cargo" + for f in $out/lib/lib*.dylib; do + install_name_tool -change /usr/lib/libresolv.9.dylib '${darwin.libresolv}/lib/libresolv.9.dylib' "$f" + done ''} - ${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 @@ -101,14 +88,23 @@ rec { phases = ["unpackPhase" "installPhase" "fixupPhase"]; - buildInputs = [ makeWrapper ]; - propagatedBuildInputs = stdenv.lib.optional stdenv.isDarwin Security; + buildInputs = [ makeWrapper ] ++ stdenv.lib.optional stdenv.isDarwin Security; installPhase = '' ./install.sh --prefix=$out \ --components=cargo - ${patchBootstrapCargo} + ${optionalString (stdenv.isLinux && bootstrapping) '' + patchelf \ + --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" + install_name_tool -change /usr/lib/libresolv.9.dylib '${darwin.libresolv}/lib/libresolv.9.dylib' "$out/bin/cargo" + install_name_tool -change /usr/lib/libcurl.4.dylib '${stdenv.lib.getLib curl}/lib/libcurl.4.dylib' "$out/bin/cargo" + ''} wrapProgram "$out/bin/cargo" \ --suffix PATH : "${rustc}/bin" diff --git a/pkgs/development/compilers/rust/rustc.nix b/pkgs/development/compilers/rust/rustc.nix index ec0f100fb568e..d93d8a906e0e4 100644 --- a/pkgs/development/compilers/rust/rustc.nix +++ b/pkgs/development/compilers/rust/rustc.nix @@ -17,13 +17,13 @@ let inherit (stdenv.lib) optional optionalString; + inherit (darwin.apple_sdk.frameworks) Security; procps = if stdenv.isDarwin then darwin.ps else args.procps; llvmShared = llvm.override { enableSharedLibraries = true; }; target = builtins.replaceStrings [" "] [","] (builtins.toString targets); - in stdenv.mkDerivation { @@ -141,6 +141,7 @@ stdenv.mkDerivation { ++ optional (!stdenv.isDarwin) gdb; buildInputs = [ ncurses ] ++ targetToolchains + ++ optional stdenv.isDarwin Security ++ optional (!forceBundledLLVM) llvmShared; outputs = [ "out" "man" "doc" ]; |