Skip to content
This repository has been archived by the owner on Apr 12, 2021. It is now read-only.

Commit

Permalink
rustup: add zlib as runtime dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerschtli authored and Jon committed Sep 2, 2020
1 parent f9bf64f commit b2679e8
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions pkgs/development/tools/rust/rustup/default.nix
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -15,7 +21,7 @@ rustPlatform.buildRustPackage rec {

cargoSha256 = "0ghjrx7y25s6rjp06h0iyv4195x7daj57bqza01i1j4hm5nkhqhi";

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 b2679e8

Please sign in to comment.