about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/builder.rs29
-rw-r--r--src/bootstrap/config.rs5
-rwxr-xr-xsrc/bootstrap/configure.py1
-rw-r--r--src/bootstrap/dist.rs7
-rw-r--r--src/bootstrap/install.rs30
-rw-r--r--src/bootstrap/lib.rs2
-rw-r--r--src/bootstrap/test.rs2
7 files changed, 60 insertions, 16 deletions
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index 6c68ee18506..74dd4a6fa01 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -570,7 +570,7 @@ impl<'a> Builder<'a> {
         // build scripts in that situation.
         //
         // If LLVM support is disabled we need to use the snapshot compiler to compile
-        // build scripts, as the new compiler doesnt support executables.
+        // build scripts, as the new compiler doesn't support executables.
         if mode == Mode::Libstd || !self.build.config.llvm_enabled {
             cargo.env("RUSTC_SNAPSHOT", &self.initial_rustc)
                  .env("RUSTC_SNAPSHOT_LIBDIR", self.rustc_snapshot_libdir());
@@ -600,9 +600,25 @@ impl<'a> Builder<'a> {
         //
         // FIXME: the guard against msvc shouldn't need to be here
         if !target.contains("msvc") {
-            let cc = self.cc(target);
-            cargo.env(format!("CC_{}", target), cc)
-                 .env("CC", cc);
+            let ccache = self.config.ccache.as_ref();
+            let ccacheify = |s: &Path| {
+                let ccache = match ccache {
+                    Some(ref s) => s,
+                    None => return s.display().to_string(),
+                };
+                // FIXME: the cc-rs crate only recognizes the literal strings
+                // `ccache` and `sccache` when doing caching compilations, so we
+                // mirror that here. It should probably be fixed upstream to
+                // accept a new env var or otherwise work with custom ccache
+                // vars.
+                match &ccache[..] {
+                    "ccache" | "sccache" => format!("{} {}", ccache, s.display()),
+                    _ => s.display().to_string(),
+                }
+            };
+            let cc = ccacheify(&self.cc(target));
+            cargo.env(format!("CC_{}", target), &cc)
+                 .env("CC", &cc);
 
             let cflags = self.cflags(target).join(" ");
             cargo.env(format!("CFLAGS_{}", target), cflags.clone())
@@ -617,8 +633,9 @@ impl<'a> Builder<'a> {
             }
 
             if let Ok(cxx) = self.cxx(target) {
-                cargo.env(format!("CXX_{}", target), cxx)
-                     .env("CXX", cxx)
+                let cxx = ccacheify(&cxx);
+                cargo.env(format!("CXX_{}", target), &cxx)
+                     .env("CXX", &cxx)
                      .env(format!("CXXFLAGS_{}", target), cflags.clone())
                      .env("CXXFLAGS", cflags);
             }
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
index be8910120ee..4f4fd14ae8c 100644
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
@@ -13,7 +13,7 @@
 //! This module implements parsing `config.toml` configuration files to tweak
 //! how the build runs.
 
-use std::collections::HashMap;
+use std::collections::{HashMap, HashSet};
 use std::env;
 use std::fs::File;
 use std::io::prelude::*;
@@ -52,6 +52,7 @@ pub struct Config {
     pub target_config: HashMap<Interned<String>, Target>,
     pub full_bootstrap: bool,
     pub extended: bool,
+    pub tools: Option<HashSet<String>>,
     pub sanitizers: bool,
     pub profiler: bool,
     pub ignore_git: bool,
@@ -191,6 +192,7 @@ struct Build {
     python: Option<String>,
     full_bootstrap: Option<bool>,
     extended: Option<bool>,
+    tools: Option<HashSet<String>>,
     verbose: Option<usize>,
     sanitizers: Option<bool>,
     profiler: Option<bool>,
@@ -395,6 +397,7 @@ impl Config {
         set(&mut config.vendor, build.vendor);
         set(&mut config.full_bootstrap, build.full_bootstrap);
         set(&mut config.extended, build.extended);
+        config.tools = build.tools;
         set(&mut config.verbose, build.verbose);
         set(&mut config.sanitizers, build.sanitizers);
         set(&mut config.profiler, build.profiler);
diff --git a/src/bootstrap/configure.py b/src/bootstrap/configure.py
index d51752a12d9..99a3ee4e4c3 100755
--- a/src/bootstrap/configure.py
+++ b/src/bootstrap/configure.py
@@ -144,6 +144,7 @@ o("jemalloc", "rust.use-jemalloc", "build liballoc with jemalloc")
 o("full-bootstrap", "build.full-bootstrap", "build three compilers instead of two")
 o("extended", "build.extended", "build an extended rust tool set")
 
+v("tools", "build.tools", "List of extended tools will be installed")
 v("build", "build.build", "GNUs ./configure syntax LLVM build triple")
 v("host", None, "GNUs ./configure syntax LLVM host triples")
 v("target", None, "GNUs ./configure syntax LLVM target triples")
diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs
index 6717b1cb098..460fb016f16 100644
--- a/src/bootstrap/dist.rs
+++ b/src/bootstrap/dist.rs
@@ -31,6 +31,7 @@ use channel;
 use util::{cp_r, libdir, is_dylib, cp_filtered, copy, replace_in_file};
 use builder::{Builder, RunConfig, ShouldRun, Step};
 use compile;
+use native;
 use tool::{self, Tool};
 use cache::{INTERNER, Interned};
 use time;
@@ -898,6 +899,12 @@ impl Step for PlainSourceTarball {
                    .arg("--vers").arg(CARGO_VENDOR_VERSION)
                    .arg("cargo-vendor")
                    .env("RUSTC", &build.initial_rustc);
+                if let Some(dir) = build.openssl_install_dir(build.config.build) {
+                    builder.ensure(native::Openssl {
+                        target: build.config.build,
+                    });
+                    cmd.env("OPENSSL_DIR", dir);
+                }
                 build.run(&mut cmd);
             }
 
diff --git a/src/bootstrap/install.rs b/src/bootstrap/install.rs
index 743f32ece99..20f7d379a69 100644
--- a/src/bootstrap/install.rs
+++ b/src/bootstrap/install.rs
@@ -22,6 +22,7 @@ use dist::{self, pkgname, sanitize_sh, tmpdir};
 
 use builder::{Builder, RunConfig, ShouldRun, Step};
 use cache::Interned;
+use config::Config;
 
 pub fn install_docs(builder: &Builder, stage: u32, host: Interned<String>) {
     install_sh(builder, "docs", "rust-docs", stage, Some(host));
@@ -144,6 +145,19 @@ macro_rules! install {
             pub host: Interned<String>,
         }
 
+        impl $name {
+            #[allow(dead_code)]
+            fn should_build(config: &Config) -> bool {
+                config.extended && config.tools.as_ref()
+                    .map_or(true, |t| t.contains($path))
+            }
+
+            #[allow(dead_code)]
+            fn should_install(builder: &Builder) -> bool {
+                builder.config.tools.as_ref().map_or(false, |t| t.contains($path))
+            }
+        }
+
         impl Step for $name {
             type Output = ();
             const DEFAULT: bool = true;
@@ -185,32 +199,34 @@ install!((self, builder, _config),
             install_std(builder, self.stage, *target);
         }
     };
-    Cargo, "cargo", _config.extended, only_hosts: true, {
+    Cargo, "cargo", Self::should_build(_config), only_hosts: true, {
         builder.ensure(dist::Cargo { stage: self.stage, target: self.target });
         install_cargo(builder, self.stage, self.target);
     };
-    Rls, "rls", _config.extended, only_hosts: true, {
-        if builder.ensure(dist::Rls { stage: self.stage, target: self.target }).is_some() {
+    Rls, "rls", Self::should_build(_config), only_hosts: true, {
+        if builder.ensure(dist::Rls { stage: self.stage, target: self.target }).is_some() ||
+            Self::should_install(builder) {
             install_rls(builder, self.stage, self.target);
         } else {
             println!("skipping Install RLS stage{} ({})", self.stage, self.target);
         }
     };
-    Rustfmt, "rustfmt", _config.extended, only_hosts: true, {
-        if builder.ensure(dist::Rustfmt { stage: self.stage, target: self.target }).is_some() {
+    Rustfmt, "rustfmt", Self::should_build(_config), only_hosts: true, {
+        if builder.ensure(dist::Rustfmt { stage: self.stage, target: self.target }).is_some() ||
+            Self::should_install(builder) {
             install_rustfmt(builder, self.stage, self.target);
         } else {
             println!("skipping Install Rustfmt stage{} ({})", self.stage, self.target);
         }
     };
-    Analysis, "analysis", _config.extended, only_hosts: false, {
+    Analysis, "analysis", Self::should_build(_config), only_hosts: false, {
         builder.ensure(dist::Analysis {
             compiler: builder.compiler(self.stage, self.host),
             target: self.target
         });
         install_analysis(builder, self.stage, self.target);
     };
-    Src, "src", _config.extended, only_hosts: true, {
+    Src, "src", Self::should_build(_config) , only_hosts: true, {
         builder.ensure(dist::Src);
         install_src(builder, self.stage);
     }, ONLY_BUILD;
diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs
index a84a6a8990b..83c270865c0 100644
--- a/src/bootstrap/lib.rs
+++ b/src/bootstrap/lib.rs
@@ -666,7 +666,7 @@ impl Build {
         }
     }
 
-    /// Returns the path to the linker for the given target if it needs to be overriden.
+    /// Returns the path to the linker for the given target if it needs to be overridden.
     fn linker(&self, target: Interned<String>) -> Option<&Path> {
         if let Some(linker) = self.config.target_config.get(&target)
                                                        .and_then(|c| c.linker.as_ref()) {
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index eae8ec1311d..f6b95f0bf97 100644
--- a/src/bootstrap/test.rs
+++ b/src/bootstrap/test.rs
@@ -902,7 +902,7 @@ impl Step for Compiletest {
             }
         }
         if suite == "run-make" && !build.config.llvm_enabled {
-            println!("Ignoring run-make test suite as they generally dont work without LLVM");
+            println!("Ignoring run-make test suite as they generally don't work without LLVM");
             return;
         }