(rustup): (add zlib to rpath in rustup libraries)

(Rust now has a dynamic library dependence on zlib. (see https://github.com/rust-lang/rust/pull/72696))
This commit is contained in:
Jade Harley
2020-06-22 21:23:01 -05:00
parent 48faedc336
commit 05b765d299
2 changed files with 25 additions and 17 deletions
+11 -4
View File
@@ -1,6 +1,6 @@
{ stdenv, lib, runCommand, patchelf
, fetchFromGitHub, rustPlatform
, pkgconfig, curl, Security, CoreServices }:
, pkgconfig, curl, zlib, Security, CoreServices }:
rustPlatform.buildRustPackage rec {
pname = "rustup";
@@ -18,18 +18,25 @@ rustPlatform.buildRustPackage rec {
nativeBuildInputs = [ pkgconfig ];
buildInputs = [
curl
curl zlib
] ++ stdenv.lib.optionals stdenv.isDarwin [ CoreServices Security ];
cargoBuildFlags = [ "--features no-self-update" ];
patches = lib.optionals stdenv.isLinux [
(runCommand "0001-dynamically-patchelf-binaries.patch" { CC=stdenv.cc; patchelf = patchelf; } ''
(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 dynamicLinker \
--subst-var libPath
'')
)
];
doCheck = !stdenv.isAarch64 && !stdenv.isDarwin;