about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorJoshua Nelson <jnelson@cloudflare.com>2022-11-24 20:39:40 -0500
committerJoshua Nelson <github@jyn.dev>2022-12-17 14:56:37 -0600
commit6f0fc2fd337757a02fa0d948e78638d66a46f518 (patch)
tree181c901bbf689187dc6db1dfc019fabaa946e0fa /src
parent2d76a9df5d040e8dfcb23e01fc3847c628d833e4 (diff)
downloadrust-6f0fc2fd337757a02fa0d948e78638d66a46f518.tar.gz
rust-6f0fc2fd337757a02fa0d948e78638d66a46f518.zip
Symlink `build/host` -> `build/x86_64-unknown-linux-gnu` (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.
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/lib.rs19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs
index 570fe6484e3..f0c9a948727 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
     }