Navigation Menu

Skip to content

Commit

Permalink
Set BUILD_TRIPLE via build script
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Mark-Simulacrum committed Sep 20, 2020
1 parent 81e0270 commit 6d19561
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/bootstrap/Cargo.toml
Expand Up @@ -3,6 +3,7 @@ authors = ["The Rust Project Developers"]
name = "bootstrap"
version = "0.0.0"
edition = "2018"
build = "build.rs"

[lib]
path = "lib.rs"
Expand Down
1 change: 0 additions & 1 deletion src/bootstrap/bootstrap.py
Expand Up @@ -1032,7 +1032,6 @@ def bootstrap(help_triggered):
args = [build.bootstrap_binary()]
args.extend(sys.argv[1:])
env = os.environ.copy()
env["BUILD"] = build.build
env["SRC"] = build.rust_root
env["BOOTSTRAP_PARENT_ID"] = str(os.getpid())
env["BOOTSTRAP_PYTHON"] = sys.executable
Expand Down
3 changes: 3 additions & 0 deletions src/bootstrap/build.rs
@@ -0,0 +1,3 @@
fn main() {
println!("cargo:rustc-env=BUILD_TRIPLE={}", std::env::var("HOST").unwrap());
}
2 changes: 1 addition & 1 deletion src/bootstrap/config.rs
Expand Up @@ -487,7 +487,7 @@ impl Config {
config.missing_tools = false;

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

Expand Down

0 comments on commit 6d19561

Please sign in to comment.