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