Auto merge of #39206 - MJDSys:fix_rustbuild_libdir, r=alexcrichton

Fix rustbuild to work with --libdir.

Similar to the makefiles, pass CFG_LIBDIR_RELATIVE to cargo when building
rustc in stages > 0.  This tells rustc to check the different directory.

I'm not sure how you want this handled in the toml system (my distribution, Gentoo, uses configure still).  I have a feeling the system needs a rework anyways for rustbuild.  If there is some discussion that needs to happen, could you merge this in the mean time?  I'd be happy to help transition this to a better method.
This commit is contained in:
bors 2017-01-21 08:41:40 +00:00
commit d8801287a3
2 changed files with 12 additions and 2 deletions

View File

@ -194,8 +194,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.

View File

@ -90,6 +90,7 @@ pub struct Config {
pub prefix: Option<PathBuf>,
pub docdir: Option<PathBuf>,
pub libdir: Option<PathBuf>,
pub libdir_relative: Option<PathBuf>,
pub mandir: Option<PathBuf>,
pub codegen_tests: bool,
pub nodejs: Option<PathBuf>,
@ -477,6 +478,9 @@ impl Config {
"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));
}