Skip to content

Commit 6d19561

Browse files
Set BUILD_TRIPLE via build script
This moves build triple discovery for rustbuild from bootstrap.py into a build script, meaning it will "just work" if building rustbuild via Cargo rather than Python.
1 parent 81e0270 commit 6d19561

File tree

4 files changed

+5
-2
lines changed

4 files changed

+5
-2
lines changed

src/bootstrap/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ authors = ["The Rust Project Developers"]
33
name = "bootstrap"
44
version = "0.0.0"
55
edition = "2018"
6+
build = "build.rs"
67

78
[lib]
89
path = "lib.rs"

src/bootstrap/bootstrap.py

-1
Original file line numberDiff line numberDiff line change
@@ -1032,7 +1032,6 @@ def bootstrap(help_triggered):
10321032
args = [build.bootstrap_binary()]
10331033
args.extend(sys.argv[1:])
10341034
env = os.environ.copy()
1035-
env["BUILD"] = build.build
10361035
env["SRC"] = build.rust_root
10371036
env["BOOTSTRAP_PARENT_ID"] = str(os.getpid())
10381037
env["BOOTSTRAP_PYTHON"] = sys.executable

src/bootstrap/build.rs

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn main() {
2+
println!("cargo:rustc-env=BUILD_TRIPLE={}", std::env::var("HOST").unwrap());
3+
}

src/bootstrap/config.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ impl Config {
487487
config.missing_tools = false;
488488

489489
// set by bootstrap.py
490-
config.build = TargetSelection::from_user(&env::var("BUILD").expect("'BUILD' to be set"));
490+
config.build = TargetSelection::from_user(&env!("BUILD_TRIPLE"));
491491
config.src = Config::path_from_python("SRC");
492492
config.out = Config::path_from_python("BUILD_DIR");
493493

0 commit comments

Comments
 (0)