Rollup merge of #104854 - jyn514:sysroot-symlink, r=Mark-Simulacrum

Symlink `build/host` -> `build/$HOST_TRIPLE`

(as appropriate per target)

This allows us to use a consistent path in the documentation, without having to worry about which platform people are using.
This commit is contained in:
Matthias Krüger 2022-12-17 23:44:25 +01:00 committed by GitHub
commit 5dc0b6ff6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
}