Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 6f7e39c76844
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: e0e2e4f2bc2b
Choose a head ref
  • 2 commits
  • 2 files changed
  • 2 contributors

Commits on Jul 7, 2020

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

    (Rust now has a dynamic library dependence on zlib. (see rust-lang/rust#72696))
    witchof0x20 authored and matklad committed Jul 7, 2020
    Copy the full SHA
    7fb99d6 View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    e0e2e4f View commit details
Showing with 25 additions and 17 deletions.
  1. +14 −13 pkgs/development/tools/rust/rustup/0001-dynamically-patchelf-binaries.patch
  2. +11 −4 pkgs/development/tools/rust/rustup/default.nix
Original file line number Diff line number Diff line change
@@ -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)]
15 changes: 11 additions & 4 deletions pkgs/development/tools/rust/rustup/default.nix
Original file line number Diff line number Diff line change
@@ -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;