]>
git.proxmox.com Git - rustc.git/blob - src/bootstrap/build.rs
2 use std
::path
::PathBuf
;
5 println
!("cargo:rerun-if-changed=build.rs");
6 println
!("cargo:rerun-if-env-changed=RUSTC");
7 println
!("cargo:rustc-env=BUILD_TRIPLE={}", env
::var("HOST").unwrap());
9 // This may not be a canonicalized path.
10 let mut rustc
= PathBuf
::from(env
::var_os("RUSTC").unwrap());
12 if rustc
.is_relative() {
13 println
!("cargo:rerun-if-env-changed=PATH");
14 for dir
in env
::split_paths(&env
::var_os("PATH").unwrap_or_default()) {
15 let absolute
= dir
.join(&rustc
);
16 if absolute
.exists() {
22 assert
!(rustc
.is_absolute());
24 // FIXME: if the path is not utf-8, this is going to break. Unfortunately
25 // Cargo doesn't have a way for us to specify non-utf-8 paths easily, so
26 // we'll need to invent some encoding scheme if this becomes a problem.
27 println
!("cargo:rustc-env=RUSTC={}", rustc
.to_str().unwrap());