2019-04-23 16:37:44 +01:00
|
|
|
diff --git a/src/dist/component/package.rs b/src/dist/component/package.rs
|
2020-06-23 01:18:42 +01:00
|
|
|
index 3beddf54..0f859b8d 100644
|
2019-04-23 16:37:44 +01:00
|
|
|
--- a/src/dist/component/package.rs
|
|
|
|
+++ b/src/dist/component/package.rs
|
2020-06-23 01:18:42 +01:00
|
|
|
@@ -113,6 +113,7 @@ impl Package for DirectoryPackage {
|
2019-04-23 16:37:44 +01:00
|
|
|
} else {
|
2020-06-23 01:18:42 +01:00
|
|
|
builder.move_file(path.clone(), &src_path)?
|
2019-04-23 16:37:44 +01:00
|
|
|
}
|
2018-07-22 10:27:06 +01:00
|
|
|
+ nix_patchelf_if_needed(&target.prefix().path().join(path.clone()), &src_path)
|
2019-04-23 16:37:44 +01:00
|
|
|
}
|
|
|
|
"dir" => {
|
|
|
|
if self.copy {
|
2020-06-23 01:18:42 +01:00
|
|
|
@@ -135,6 +136,29 @@ impl Package for DirectoryPackage {
|
2017-10-29 20:32:40 +00:00
|
|
|
}
|
|
|
|
}
|
2019-09-13 17:33:24 +01:00
|
|
|
|
2017-10-29 20:32:40 +00:00
|
|
|
+fn nix_patchelf_if_needed(dest_path: &Path, src_path: &Path) {
|
2020-06-23 01:18:42 +01:00
|
|
|
+ let (is_bin, is_lib) = if let Some(p) = src_path.parent() {
|
|
|
|
+ (p.ends_with("bin"), p.ends_with("lib"))
|
2017-10-29 20:32:40 +00:00
|
|
|
+ } else {
|
2020-06-23 01:18:42 +01:00
|
|
|
+ (false, false)
|
2017-10-29 20:32:40 +00:00
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ if is_bin {
|
|
|
|
+ let _ = ::std::process::Command::new("@patchelf@/bin/patchelf")
|
|
|
|
+ .arg("--set-interpreter")
|
|
|
|
+ .arg("@dynamicLinker@")
|
|
|
|
+ .arg(dest_path)
|
|
|
|
+ .output();
|
|
|
|
+ }
|
2020-06-23 01:18:42 +01:00
|
|
|
+ else if is_lib {
|
|
|
|
+ let _ = ::std::process::Command::new("@patchelf@/bin/patchelf")
|
|
|
|
+ .arg("--set-rpath")
|
|
|
|
+ .arg("@libPath@")
|
|
|
|
+ .arg(dest_path)
|
|
|
|
+ .output();
|
|
|
|
+ }
|
2017-10-29 20:32:40 +00:00
|
|
|
+}
|
|
|
|
+
|
2019-09-13 17:33:24 +01:00
|
|
|
#[derive(Debug)]
|
|
|
|
pub struct TarPackage<'a>(DirectoryPackage, temp::Dir<'a>);
|
|
|
|
|