Skip to content

Commit

Permalink
Rollup merge of #107842 - fee1-dead-contrib:patch_rustfmt_nixos, r=Ma…
Browse files Browse the repository at this point in the history
…rk-Simulacrum

Patch `build/rustfmt/lib/*.so` for NixOS

fixes #107676.
  • Loading branch information
matthiaskrgr committed Feb 12, 2023
2 parents d29aba1 + 2e1b78d commit ca99d51
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/bootstrap/download.rs
Expand Up @@ -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]);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit ca99d51

Please sign in to comment.