Skip to content

Commit

Permalink
Fallback to the unmodified path in bindir_relative
Browse files Browse the repository at this point in the history
  • Loading branch information
cuviper committed Nov 12, 2019
1 parent 1aee3e4 commit bfa5e5f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
3 changes: 1 addition & 2 deletions src/bootstrap/builder.rs
Expand Up @@ -1232,8 +1232,7 @@ impl<'a> Builder<'a> {
}

// 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);
cargo.env("RUSTC_INSTALL_BINDIR", self.config.bindir_relative());

self.ci_env.force_coloring_in_ci(&mut cargo);

Expand Down
15 changes: 9 additions & 6 deletions src/bootstrap/config.rs
Expand Up @@ -647,15 +647,18 @@ impl Config {
config
}

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

/// Try to find the relative path of `libdir`.
Expand Down

0 comments on commit bfa5e5f

Please sign in to comment.