biglybt: 3.5.0.0 -> 3.6.0.0
[NixPkgs.git] / pkgs / development / tools / rust / rustup / 0001-dynamically-patchelf-binaries.patch
blob2b191031da607dee899bbb35fa8549a6939de98f
1 diff --git a/src/dist/component/package.rs b/src/dist/component/package.rs
2 index 73a533b5..408ab815 100644
3 --- a/src/dist/component/package.rs
4 +++ b/src/dist/component/package.rs
5 @@ -113,6 +113,7 @@ fn install<'a>(
6 } else {
7 builder.move_file(path.clone(), &src_path)?
9 + nix_patchelf_if_needed(&target.prefix().path().join(path.clone()), &src_path)
11 "dir" => {
12 if self.copy {
13 @@ -135,6 +136,29 @@ fn components(&self) -> Vec<String> {
17 +fn nix_patchelf_if_needed(dest_path: &Path, src_path: &Path) {
18 + let (is_bin, is_lib) = if let Some(p) = src_path.parent() {
19 + (p.ends_with("bin") || p.ends_with("libexec"), p.ends_with("lib"))
20 + } else {
21 + (false, false)
22 + };
24 + if is_bin {
25 + let _ = ::std::process::Command::new("@patchelf@/bin/patchelf")
26 + .arg("--set-interpreter")
27 + .arg("@dynamicLinker@")
28 + .arg(dest_path)
29 + .output();
30 + }
31 + else if is_lib {
32 + let _ = ::std::process::Command::new("@patchelf@/bin/patchelf")
33 + .arg("--set-rpath")
34 + .arg("@libPath@")
35 + .arg(dest_path)
36 + .output();
37 + }
40 #[derive(Debug)]
41 pub(crate) struct TarPackage<'a>(DirectoryPackage, temp::Dir<'a>);