diff options
| author | Deadbeef <ent3rm4n@gmail.com> | 2023-02-09 19:38:55 +0800 |
|---|---|---|
| committer | Deadbeef <ent3rm4n@gmail.com> | 2023-02-09 19:38:55 +0800 |
| commit | 2e1b78ddb9146d0f2ad96a08d664ae08d69cf341 (patch) | |
| tree | b4753a890989ed955709d00c05a347c8741fded5 | |
| parent | c40919b7a75f93ed7ef040361e82c656d246d41e (diff) | |
| download | rust-2e1b78ddb9146d0f2ad96a08d664ae08d69cf341.tar.gz rust-2e1b78ddb9146d0f2ad96a08d664ae08d69cf341.zip | |
Patch `build/rustfmt/lib/*.so` for NixOS
fixes #107676.
| -rw-r--r-- | src/bootstrap/download.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/bootstrap/download.rs b/src/bootstrap/download.rs index bd67978a766..3e3a59daab5 100644 --- a/src/bootstrap/download.rs +++ b/src/bootstrap/download.rs @@ -173,8 +173,7 @@ impl Config { // appear to have this (even when `../lib` is redundant). // NOTE: there are only two paths here, delimited by a `:` let mut entries = OsString::from("$ORIGIN/../lib:"); - entries.push(t!(fs::canonicalize(nix_deps_dir))); - entries.push("/lib"); + entries.push(t!(fs::canonicalize(nix_deps_dir)).join("lib")); entries }; patchelf.args(&[OsString::from("--set-rpath"), rpath_entries]); @@ -353,6 +352,13 @@ impl Config { if self.should_fix_bins_and_dylibs() { self.fix_bin_or_dylib(&bin_root.join("bin").join("rustfmt")); self.fix_bin_or_dylib(&bin_root.join("bin").join("cargo-fmt")); + let lib_dir = bin_root.join("lib"); + for lib in t!(fs::read_dir(&lib_dir), lib_dir.display().to_string()) { + let lib = t!(lib); + if lib.path().extension() == Some(OsStr::new("so")) { + self.fix_bin_or_dylib(&lib.path()); + } + } } self.create(&rustfmt_stamp, &channel); |
