about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-05-23 20:02:23 -0700
committerbors <bors@rust-lang.org>2016-05-23 20:02:23 -0700
commitdd6e8d45e183861d44ed91a99f0a50403b2776a3 (patch)
tree50eda6cbc0faf38303702e7ff2c9f9766bcd3bb1 /src
parent57ef015132ec09345b88d2ec20a9d9809b5d3dfc (diff)
parent0ca7d3dc1ffdf97284d62960a3c2170dae5f1e43 (diff)
downloadrust-dd6e8d45e183861d44ed91a99f0a50403b2776a3.tar.gz
rust-dd6e8d45e183861d44ed91a99f0a50403b2776a3.zip
Auto merge of #33787 - cuviper:local-rebuild, r=alexcrichton
Add --enable-local-rebuild to bootstrap from the current release

In Linux distributions, it is often necessary to rebuild packages for cases like applying new patches or linking against new system libraries.  In this scenario, the rustc in the distro build environment may already match the current release that we're trying to rebuild.  Thus we don't want to use the prior release's bootstrap key, nor `--cfg stage0` for the prior unstable features.

The new `configure --enable-local-rebuild` option specifies that we are rebuilding from the current release.  The current bootstrap key is used for the local rustc, and current stage1 features are also assumed.  Both the makefiles and rustbuild support this configuration.

Fixes #29556
r? @alexcrichton
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/build/config.rs2
-rw-r--r--src/bootstrap/build/mod.rs12
2 files changed, 12 insertions, 2 deletions
diff --git a/src/bootstrap/build/config.rs b/src/bootstrap/build/config.rs
index 3c35b9a9516..fb1ad12d914 100644
--- a/src/bootstrap/build/config.rs
+++ b/src/bootstrap/build/config.rs
@@ -67,6 +67,7 @@ pub struct Config {
     pub target: Vec<String>,
     pub rustc: Option<String>,
     pub cargo: Option<String>,
+    pub local_rebuild: bool,
 
     // libstd features
     pub debug_jemalloc: bool,
@@ -315,6 +316,7 @@ impl Config {
                 ("RPATH", self.rust_rpath),
                 ("OPTIMIZE_TESTS", self.rust_optimize_tests),
                 ("DEBUGINFO_TESTS", self.rust_debuginfo_tests),
+                ("LOCAL_REBUILD", self.local_rebuild),
             }
 
             match key {
diff --git a/src/bootstrap/build/mod.rs b/src/bootstrap/build/mod.rs
index ebc05c5f61c..21d12d27d92 100644
--- a/src/bootstrap/build/mod.rs
+++ b/src/bootstrap/build/mod.rs
@@ -510,6 +510,14 @@ impl Build {
              .arg("-j").arg(self.jobs().to_string())
              .arg("--target").arg(target);
 
+        let stage;
+        if compiler.stage == 0 && self.config.local_rebuild {
+            // Assume the local-rebuild rustc already has stage1 features.
+            stage = 1;
+        } else {
+            stage = compiler.stage;
+        }
+
         // Customize the compiler we're running. Specify the compiler to cargo
         // as our shim and then pass it some various options used to configure
         // how the actual compiler itself is called.
@@ -518,7 +526,7 @@ impl Build {
         // src/bootstrap/{rustc,rustdoc.rs}
         cargo.env("RUSTC", self.out.join("bootstrap/debug/rustc"))
              .env("RUSTC_REAL", self.compiler_path(compiler))
-             .env("RUSTC_STAGE", compiler.stage.to_string())
+             .env("RUSTC_STAGE", stage.to_string())
              .env("RUSTC_DEBUGINFO", self.config.rust_debuginfo.to_string())
              .env("RUSTC_CODEGEN_UNITS",
                   self.config.rust_codegen_units.to_string())
@@ -744,7 +752,7 @@ impl Build {
         // In stage0 we're using a previously released stable compiler, so we
         // use the stage0 bootstrap key. Otherwise we use our own build's
         // bootstrap key.
-        let bootstrap_key = if compiler.is_snapshot(self) {
+        let bootstrap_key = if compiler.is_snapshot(self) && !self.config.local_rebuild {
             &self.bootstrap_key_stage0
         } else {
             &self.bootstrap_key