Skip to content

Commit

Permalink
rustup: add zlib as runtime dependency
Browse files Browse the repository at this point in the history
Fixes #92946.

(cherry picked from commit b2679e8)
  • Loading branch information
Gerschtli authored and Jon committed Sep 4, 2020
1 parent 5607e74 commit 51d115a
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions pkgs/development/tools/rust/rustup/default.nix
@@ -1,7 +1,13 @@
{ stdenv, lib, runCommand, patchelf
, fetchFromGitHub, rustPlatform
, fetchFromGitHub, rustPlatform, makeWrapper
, pkgconfig, curl, zlib, Security, CoreServices }:

let
libPath = lib.makeLibraryPath [
zlib # libz.so.1
];
in

rustPlatform.buildRustPackage rec {
pname = "rustup";
version = "1.21.1";
Expand All @@ -15,7 +21,7 @@ rustPlatform.buildRustPackage rec {

cargoSha256 = "0kn3sq99sgsh8msignyb4vjllv0wf1crqaw7sqp3ggmlkrdq35sd";

nativeBuildInputs = [ pkgconfig ];
nativeBuildInputs = [ makeWrapper pkgconfig ];

buildInputs = [
curl zlib
Expand All @@ -24,19 +30,13 @@ rustPlatform.buildRustPackage rec {
cargoBuildFlags = [ "--features no-self-update" ];

patches = lib.optionals stdenv.isLinux [
(let
libPath = lib.makeLibraryPath [
zlib # libz.so.1
];
in
(runCommand "0001-dynamically-patchelf-binaries.patch" { CC=stdenv.cc; patchelf = patchelf; libPath = "$ORIGIN/../lib:${libPath}"; } ''
export dynamicLinker=$(cat $CC/nix-support/dynamic-linker)
substitute ${./0001-dynamically-patchelf-binaries.patch} $out \
--subst-var patchelf \
--subst-var dynamicLinker \
--subst-var libPath
(runCommand "0001-dynamically-patchelf-binaries.patch" { CC=stdenv.cc; patchelf = patchelf; libPath = "$ORIGIN/../lib:${libPath}"; } ''
export dynamicLinker=$(cat $CC/nix-support/dynamic-linker)
substitute ${./0001-dynamically-patchelf-binaries.patch} $out \
--subst-var patchelf \
--subst-var dynamicLinker \
--subst-var libPath
'')
)
];

doCheck = !stdenv.isAarch64 && !stdenv.isDarwin;
Expand All @@ -53,6 +53,8 @@ rustPlatform.buildRustPackage rec {
done
popd
wrapProgram $out/bin/rustup --prefix "LD_LIBRARY_PATH" : "${libPath}"
# tries to create .rustup
export HOME=$(mktemp -d)
mkdir -p "$out/share/"{bash-completion/completions,fish/vendor_completions.d,zsh/site-functions}
Expand Down

0 comments on commit 51d115a

Please sign in to comment.