]> git.lizzy.rs Git - rust.git/commitdiff
Fix rustbuild to work with --libdir.
authorMatthew Dawson <matthew@mjdsystems.ca>
Fri, 20 Jan 2017 14:22:16 +0000 (09:22 -0500)
committerMatthew Dawson <matthew@mjdsystems.ca>
Fri, 20 Jan 2017 16:46:51 +0000 (11:46 -0500)
Similar to the makefiles, pass CFG_LIBDIR_RELATIVE to cargo when building
rustc in stages > 0.  This tells rustc to check the different directory.

src/bootstrap/compile.rs
src/bootstrap/config.rs

index 0eeb799672cf200a5406aae656cad80ec16a71fa..b91955f89650e342521c0a192173fc4c536b085d 100644 (file)
@@ -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.
index 8e2129758f6d0aeba02cc943ab72573292d90360..152164342cdd2ba042a73babc851cc52263eddc2 100644 (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 @@ macro_rules! check {
                 "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));
                 }