rustup: add zlib as runtime dependency

Fixes https://github.com/NixOS/nixpkgs/issues/92946.
This commit is contained in:
Tobias Happ 2020-08-31 19:49:52 +02:00 committed by Jon
parent f9bf64f0c4
commit b2679e8b41

View File

@ -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.22.1";
@ -15,7 +21,7 @@ rustPlatform.buildRustPackage rec {
cargoSha256 = "0ghjrx7y25s6rjp06h0iyv4195x7daj57bqza01i1j4hm5nkhqhi";
nativeBuildInputs = [ pkgconfig ];
nativeBuildInputs = [ makeWrapper pkgconfig ];
buildInputs = [
curl zlib
@ -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;
@ -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}