Skip to content

Commit ca99d51

Browse files
authored
Rollup merge of #107842 - fee1-dead-contrib:patch_rustfmt_nixos, r=Mark-Simulacrum
Patch `build/rustfmt/lib/*.so` for NixOS fixes #107676.
2 parents d29aba1 + 2e1b78d commit ca99d51

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/bootstrap/download.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,7 @@ impl Config {
181181
// appear to have this (even when `../lib` is redundant).
182182
// NOTE: there are only two paths here, delimited by a `:`
183183
let mut entries = OsString::from("$ORIGIN/../lib:");
184-
entries.push(t!(fs::canonicalize(nix_deps_dir)));
185-
entries.push("/lib");
184+
entries.push(t!(fs::canonicalize(nix_deps_dir)).join("lib"));
186185
entries
187186
};
188187
patchelf.args(&[OsString::from("--set-rpath"), rpath_entries]);
@@ -370,6 +369,13 @@ impl Config {
370369
if self.should_fix_bins_and_dylibs() {
371370
self.fix_bin_or_dylib(&bin_root.join("bin").join("rustfmt"));
372371
self.fix_bin_or_dylib(&bin_root.join("bin").join("cargo-fmt"));
372+
let lib_dir = bin_root.join("lib");
373+
for lib in t!(fs::read_dir(&lib_dir), lib_dir.display().to_string()) {
374+
let lib = t!(lib);
375+
if lib.path().extension() == Some(OsStr::new("so")) {
376+
self.fix_bin_or_dylib(&lib.path());
377+
}
378+
}
373379
}
374380

375381
self.create(&rustfmt_stamp, &channel);

0 commit comments

Comments
 (0)