Skip to content

Commit 2e1b78d

Browse files
committed
Patch build/rustfmt/lib/*.so for NixOS
fixes rust-lang#107676.
1 parent c40919b commit 2e1b78d

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
@@ -173,8 +173,7 @@ impl Config {
173173
// appear to have this (even when `../lib` is redundant).
174174
// NOTE: there are only two paths here, delimited by a `:`
175175
let mut entries = OsString::from("$ORIGIN/../lib:");
176-
entries.push(t!(fs::canonicalize(nix_deps_dir)));
177-
entries.push("/lib");
176+
entries.push(t!(fs::canonicalize(nix_deps_dir)).join("lib"));
178177
entries
179178
};
180179
patchelf.args(&[OsString::from("--set-rpath"), rpath_entries]);
@@ -353,6 +352,13 @@ impl Config {
353352
if self.should_fix_bins_and_dylibs() {
354353
self.fix_bin_or_dylib(&bin_root.join("bin").join("rustfmt"));
355354
self.fix_bin_or_dylib(&bin_root.join("bin").join("cargo-fmt"));
355+
let lib_dir = bin_root.join("lib");
356+
for lib in t!(fs::read_dir(&lib_dir), lib_dir.display().to_string()) {
357+
let lib = t!(lib);
358+
if lib.path().extension() == Some(OsStr::new("so")) {
359+
self.fix_bin_or_dylib(&lib.path());
360+
}
361+
}
356362
}
357363

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

0 commit comments

Comments
 (0)