aboutsummaryrefslogtreecommitdiff
path: root/nixpkgs/pkgs/development/tools/rust/rustup
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/tools/rust/rustup')
-rw-r--r--nixpkgs/pkgs/development/tools/rust/rustup/0001-dynamically-patchelf-binaries.patch27
-rw-r--r--nixpkgs/pkgs/development/tools/rust/rustup/default.nix34
2 files changed, 35 insertions, 26 deletions
diff --git a/nixpkgs/pkgs/development/tools/rust/rustup/0001-dynamically-patchelf-binaries.patch b/nixpkgs/pkgs/development/tools/rust/rustup/0001-dynamically-patchelf-binaries.patch
index d46ad59109e..13649b387a3 100644
--- a/nixpkgs/pkgs/development/tools/rust/rustup/0001-dynamically-patchelf-binaries.patch
+++ b/nixpkgs/pkgs/development/tools/rust/rustup/0001-dynamically-patchelf-binaries.patch
@@ -1,30 +1,24 @@
diff --git a/src/dist/component/package.rs b/src/dist/component/package.rs
-index 4b432785..fa45e87e 100644
+index 3beddf54..0f859b8d 100644
--- a/src/dist/component/package.rs
+++ b/src/dist/component/package.rs
-@@ -109,10 +109,11 @@ impl Package for DirectoryPackage {
- match &*part.0 {
- "file" => {
- if self.copy {
-- builder.copy_file(path.clone(), &src_path)?
-+ builder.copy_file(path.clone(), &src_path)?;
+@@ -113,6 +113,7 @@ impl Package for DirectoryPackage {
} else {
-- builder.move_file(path.clone(), &src_path)?
-+ builder.move_file(path.clone(), &src_path)?;
+ builder.move_file(path.clone(), &src_path)?
}
+ nix_patchelf_if_needed(&target.prefix().path().join(path.clone()), &src_path)
}
"dir" => {
if self.copy {
-@@ -135,6 +136,22 @@ impl Package for DirectoryPackage {
+@@ -135,6 +136,29 @@ impl Package for DirectoryPackage {
}
}
+fn nix_patchelf_if_needed(dest_path: &Path, src_path: &Path) {
-+ let is_bin = if let Some(p) = src_path.parent() {
-+ p.ends_with("bin")
++ let (is_bin, is_lib) = if let Some(p) = src_path.parent() {
++ (p.ends_with("bin"), p.ends_with("lib"))
+ } else {
-+ false
++ (false, false)
+ };
+
+ if is_bin {
@@ -34,6 +28,13 @@ index 4b432785..fa45e87e 100644
+ .arg(dest_path)
+ .output();
+ }
++ else if is_lib {
++ let _ = ::std::process::Command::new("@patchelf@/bin/patchelf")
++ .arg("--set-rpath")
++ .arg("@libPath@")
++ .arg(dest_path)
++ .output();
++ }
+}
+
#[derive(Debug)]
diff --git a/nixpkgs/pkgs/development/tools/rust/rustup/default.nix b/nixpkgs/pkgs/development/tools/rust/rustup/default.nix
index 959eb6875ce..e5ef80b87ee 100644
--- a/nixpkgs/pkgs/development/tools/rust/rustup/default.nix
+++ b/nixpkgs/pkgs/development/tools/rust/rustup/default.nix
@@ -1,34 +1,41 @@
{ stdenv, lib, runCommand, patchelf
-, fetchFromGitHub, rustPlatform
-, pkgconfig, curl, Security, CoreServices }:
+, 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";
+ version = "1.22.1";
src = fetchFromGitHub {
owner = "rust-lang";
repo = "rustup";
rev = version;
- sha256 = "0d7l3j8js16zgdx37kykavr343v65vchldz88j38jjyc43pcm2pg";
+ sha256 = "0nf42pkyn87y0n93vd63bihx74h4bpisv74aqldg3vcav2iv35s1";
};
- cargoSha256 = "1y13kfski36rfvqkp3mxxn12aidp339j7rigv49msyr004ac5y8s";
+ cargoSha256 = "0ghjrx7y25s6rjp06h0iyv4195x7daj57bqza01i1j4hm5nkhqhi";
- nativeBuildInputs = [ pkgconfig ];
+ nativeBuildInputs = [ makeWrapper 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; } ''
- export dynamicLinker=$(cat $CC/nix-support/dynamic-linker)
- substitute ${./0001-dynamically-patchelf-binaries.patch} $out \
- --subst-var patchelf \
- --subst-var dynamicLinker
+ (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
'')
];
@@ -46,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}
@@ -66,6 +75,5 @@ rustPlatform.buildRustPackage rec {
homepage = "https://www.rustup.rs/";
license = with licenses; [ asl20 /* or */ mit ];
maintainers = [ maintainers.mic92 ];
- platforms = platforms.all;
};
}