diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index 0eeb799672cf200a5406aae656cad80ec16a71fa..b91955f89650e342521c0a192173fc4c536b085d 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -185,8 +185,14 @@ pub fn rustc(build: &Build, target: &str, compiler: &Compiler) { cargo.env("CFG_RELEASE", &build.release) .env("CFG_RELEASE_CHANNEL", &build.config.channel) .env("CFG_VERSION", &build.version) - .env("CFG_PREFIX", build.config.prefix.clone().unwrap_or(PathBuf::new())) - .env("CFG_LIBDIR_RELATIVE", "lib"); + .env("CFG_PREFIX", build.config.prefix.clone().unwrap_or(PathBuf::new())); + + if compiler.stage == 0 { + cargo.env("CFG_LIBDIR_RELATIVE", "lib"); + } else { + let libdir_relative = build.config.libdir_relative.clone().unwrap_or(PathBuf::from("lib")); + cargo.env("CFG_LIBDIR_RELATIVE", libdir_relative); + } // If we're not building a compiler with debugging information then remove // these two env vars which would be set otherwise. diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index 8e2129758f6d0aeba02cc943ab72573292d90360..152164342cdd2ba042a73babc851cc52263eddc2 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -90,6 +90,7 @@ pub struct Config { pub prefix: Option, pub docdir: Option, pub libdir: Option, + pub libdir_relative: Option, pub mandir: Option, pub codegen_tests: bool, pub nodejs: Option, @@ -477,6 +478,9 @@ pub fn update_with_config_mk(&mut self) { "CFG_LIBDIR" => { self.libdir = Some(PathBuf::from(value)); } + "CFG_LIBDIR_RELATIVE" => { + self.libdir_relative = Some(PathBuf::from(value)); + } "CFG_MANDIR" => { self.mandir = Some(PathBuf::from(value)); }