Skip to content

Use a relative bindir for rustdoc to find rustc #66317

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 13, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1231,7 +1231,9 @@ impl<'a> Builder<'a> {
cargo.arg("--frozen");
}

cargo.env("RUSTC_INSTALL_BINDIR", &self.config.bindir);
// Try to use a sysroot-relative bindir, in case it was configured absolutely.
let bindir = self.config.bindir_relative().unwrap_or(&self.config.bindir);
cargo.env("RUSTC_INSTALL_BINDIR", bindir);

self.ci_env.force_coloring_in_ci(&mut cargo);

Expand Down
11 changes: 11 additions & 0 deletions src/bootstrap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,17 @@ impl Config {
config
}

/// Try to find the relative path of `bindir`.
pub fn bindir_relative(&self) -> Option<&Path> {
let bindir = &self.bindir;
if bindir.is_relative() {
Some(bindir)
} else {
// Try to make it relative to the prefix.
bindir.strip_prefix(self.prefix.as_ref()?).ok()
}
}

/// Try to find the relative path of `libdir`.
pub fn libdir_relative(&self) -> Option<&Path> {
let libdir = self.libdir.as_ref()?;
Expand Down