forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#76544 - Mark-Simulacrum:less-python, r=alex…
…crichton De-couple Python and bootstrap slightly This revises rustbuild's entry points from Python to rely less on magic environment variables, preferring to use Cargo-provided environment variables where feasible. Notably, BUILD_DIR and BOOTSTRAP_CONFIG are *not* moved, because both more-or-less have some non-trivial discovery logic and replicating it in rustbuild seems unfortunate; if it moved to Cargo that would be a different story. Best reviewed by-commit.
- Loading branch information
Showing
7 changed files
with
53 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use std::env; | ||
use std::path::PathBuf; | ||
|
||
fn main() { | ||
println!("cargo:rerun-if-changed=build.rs"); | ||
println!("cargo:rustc-env=BUILD_TRIPLE={}", env::var("HOST").unwrap()); | ||
|
||
// This may not be a canonicalized path. | ||
let mut rustc = PathBuf::from(env::var_os("RUSTC").unwrap()); | ||
|
||
if rustc.is_relative() { | ||
for dir in env::split_paths(&env::var_os("PATH").unwrap_or_default()) { | ||
let absolute = dir.join(&rustc); | ||
if absolute.exists() { | ||
rustc = absolute; | ||
break; | ||
} | ||
} | ||
} | ||
assert!(rustc.is_absolute()); | ||
|
||
// FIXME: if the path is not utf-8, this is going to break. Unfortunately | ||
// Cargo doesn't have a way for us to specify non-utf-8 paths easily, so | ||
// we'll need to invent some encoding scheme if this becomes a problem. | ||
println!("cargo:rustc-env=RUSTC={}", rustc.to_str().unwrap()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters