2021-03-26 17:47:19 +00:00
|
|
|
diff --git a/src/elan-dist/src/component/package.rs b/src/elan-dist/src/component/package.rs
|
2021-11-01 12:37:56 +00:00
|
|
|
index c51e76d..d0a26d7 100644
|
2021-03-26 17:47:19 +00:00
|
|
|
--- a/src/elan-dist/src/component/package.rs
|
|
|
|
+++ b/src/elan-dist/src/component/package.rs
|
2021-11-01 12:37:56 +00:00
|
|
|
@@ -56,11 +56,35 @@ fn unpack_without_first_dir<R: Read>(archive: &mut tar::Archive<R>, path: &Path)
|
|
|
|
entry
|
|
|
|
.unpack(&full_path)
|
|
|
|
.chain_err(|| ErrorKind::ExtractingPackage)?;
|
2021-03-26 17:47:19 +00:00
|
|
|
+ nix_patchelf_if_needed(&full_path);
|
|
|
|
}
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
|
|
|
+fn nix_patchelf_if_needed(dest_path: &Path) {
|
|
|
|
+ let (is_bin, is_lib) = if let Some(p) = dest_path.parent() {
|
|
|
|
+ (p.ends_with("bin"), p.ends_with("lib"))
|
|
|
|
+ } else {
|
|
|
|
+ (false, false)
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ if is_bin {
|
|
|
|
+ let _ = ::std::process::Command::new("@patchelf@/bin/patchelf")
|
|
|
|
+ .arg("--set-interpreter")
|
|
|
|
+ .arg("@dynamicLinker@")
|
|
|
|
+ .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)]
|
|
|
|
pub struct ZipPackage<'a>(temp::Dir<'a>);
|
|
|
|
|