mirror of
https://github.com/Noratrieb/nixos.git
synced 2026-01-16 12:45:14 +01:00
cargo-bisect-rustc
This commit is contained in:
parent
e9e1711063
commit
b6ef4f0ddf
4 changed files with 124 additions and 1 deletions
71
custom-pkgs/cargo-bisect-rustc/0001-patchelf.patch
Normal file
71
custom-pkgs/cargo-bisect-rustc/0001-patchelf.patch
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
diff --git a/src/toolchains.rs b/src/toolchains.rs
|
||||
index 16e68a0..5ce1c50 100644
|
||||
--- a/src/toolchains.rs
|
||||
+++ b/src/toolchains.rs
|
||||
@@ -34,6 +34,8 @@ pub(crate) enum InstallError {
|
||||
TempDir(#[source] io::Error),
|
||||
#[error("Could not move tempdir into destination: {0}")]
|
||||
Move(#[source] io::Error),
|
||||
+ #[error("Could not patchelf")]
|
||||
+ Patchelf(#[source] io::Error),
|
||||
#[error("Could not run subcommand {cmd}: {err}")]
|
||||
Subcommand {
|
||||
cmd: String,
|
||||
@@ -208,7 +210,9 @@ impl Toolchain {
|
||||
})?;
|
||||
}
|
||||
|
||||
- fs::rename(tmpdir.into_path(), dest).map_err(InstallError::Move)
|
||||
+ fs::rename(tmpdir.into_path(), &dest).map_err(InstallError::Move)?;
|
||||
+ nix_patchelf(dest).map_err(InstallError::Patchelf)?;
|
||||
+ Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn remove(&self, dl_params: &DownloadParams) -> io::Result<()> {
|
||||
@@ -542,3 +546,46 @@ fn download_tarball(
|
||||
res => res,
|
||||
}
|
||||
}
|
||||
+
|
||||
+fn nix_patchelf(mut toolchain_path: PathBuf) -> Result<(), io::Error> {
|
||||
+ toolchain_path.push("bin");
|
||||
+
|
||||
+ for entry in toolchain_path.read_dir()? {
|
||||
+ let entry = entry?;
|
||||
+ if !entry.file_type()?.is_file() {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ eprintln!(
|
||||
+ "info: you seem to be running NixOS. Attempting to patch {}",
|
||||
+ entry.path().to_str().unwrap()
|
||||
+ );
|
||||
+ let _ = ::std::process::Command::new("@patchelf@/bin/patchelf")
|
||||
+ .arg("--set-interpreter")
|
||||
+ .arg("@dynamicLinker@")
|
||||
+ .arg(entry.path())
|
||||
+ .output();
|
||||
+ }
|
||||
+
|
||||
+ toolchain_path.pop();
|
||||
+ toolchain_path.push("lib");
|
||||
+
|
||||
+ for entry in toolchain_path.read_dir()? {
|
||||
+ let entry = entry?;
|
||||
+ if !entry.file_type()?.is_file() {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ eprintln!(
|
||||
+ "info: you seem to be running NixOS. Attempting to patch {}",
|
||||
+ entry.path().to_str().unwrap()
|
||||
+ );
|
||||
+ let _ = ::std::process::Command::new("@patchelf@/bin/patchelf")
|
||||
+ .arg("--set-rpath")
|
||||
+ .arg("@libPath@")
|
||||
+ .arg(entry.path())
|
||||
+ .output();
|
||||
+ }
|
||||
+
|
||||
+ Ok(())
|
||||
+}
|
||||
Loading…
Add table
Add a link
Reference in a new issue