about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-02-12 22:29:47 +0100
committerGitHub <noreply@github.com>2023-02-12 22:29:47 +0100
commitca99d51b6d459500d43a1ffb52188c54041fc754 (patch)
tree376b8158f89dfec0fe1d8c0b10f42b9608400862
parentd29aba19d01e51a05dafb6c4a064d11979f6f7aa (diff)
parent2e1b78ddb9146d0f2ad96a08d664ae08d69cf341 (diff)
downloadrust-ca99d51b6d459500d43a1ffb52188c54041fc754.tar.gz
rust-ca99d51b6d459500d43a1ffb52188c54041fc754.zip
Rollup merge of #107842 - fee1-dead-contrib:patch_rustfmt_nixos, r=Mark-Simulacrum
Patch `build/rustfmt/lib/*.so` for NixOS

fixes #107676.
-rw-r--r--src/bootstrap/download.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/bootstrap/download.rs b/src/bootstrap/download.rs
index 6dcba117c24..d6592d2d771 100644
--- a/src/bootstrap/download.rs
+++ b/src/bootstrap/download.rs
@@ -181,8 +181,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]);
@@ -370,6 +369,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);