diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 570fe6484e3db..f0c9a948727f0 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -108,6 +108,7 @@ use std::collections::{HashMap, HashSet}; use std::env; use std::fs::{self, File}; use std::io; +use std::io::ErrorKind; use std::path::{Path, PathBuf}; use std::process::Command; use std::str; @@ -119,7 +120,9 @@ use once_cell::sync::OnceCell; use crate::builder::Kind; use crate::config::{LlvmLibunwind, TargetSelection}; -use crate::util::{exe, libdir, mtime, output, run, run_suppressed, try_run_suppressed, CiEnv}; +use crate::util::{ + exe, libdir, mtime, output, run, run_suppressed, symlink_dir, try_run_suppressed, CiEnv, +}; mod bolt; mod builder; @@ -586,6 +589,20 @@ impl Build { metadata::build(&mut build); } + // Make a symbolic link so we can use a consistent directory in the documentation. + let build_triple = build.out.join(&build.build.triple); + let host = build.out.join("host"); + if let Err(e) = symlink_dir(&build.config, &build_triple, &host) { + if e.kind() != ErrorKind::AlreadyExists { + panic!( + "symlink_dir({} => {}) failed with {}", + host.display(), + build_triple.display(), + e + ); + } + } + build }