about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-08-29 06:08:37 +0000
committerbors <bors@rust-lang.org>2020-08-29 06:08:37 +0000
commitd8424f6b426f91ae39dbeacd631a82aad5d733f4 (patch)
tree2cc658ad4c12c81cf1680608e01c5e5a3934048c /src/bootstrap
parent17fb1254b8f085c0787cc8f11ac466fcc2d8c488 (diff)
parent8b501e33e5b873b66bc421cc142d4c7430d8f005 (diff)
Auto merge of #74922 - joshtriplett:ninja-by-default, r=Mark-Simulacrum
Set ninja=true by default

Ninja substantially improves LLVM build time. On a 96-way system, using
Make took 248s, and using Ninja took 161s, a 35% improvement.

We already require a variety of tools to build Rust. If someone wants to
build without Ninja (for instance, to minimize the set of packages
required to bootstrap a new target), they can easily set `ninja=false`
in `config.toml`.  Our defaults should help people build Rust (and LLVM)
faster, to speed up development.
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/builder/tests.rs1
-rw-r--r--src/bootstrap/config.rs1
-rw-r--r--src/bootstrap/sanity.rs12
3 files changed, 12 insertions, 2 deletions
diff --git a/src/bootstrap/builder/tests.rs b/src/bootstrap/builder/tests.rs
index 111971534ba..5b6c327896b 100644
--- a/src/bootstrap/builder/tests.rs
+++ b/src/bootstrap/builder/tests.rs
@@ -8,6 +8,7 @@ fn configure(host: &[&str], target: &[&str]) -> Config {
     config.save_toolstates = None;
     config.skip_only_host_steps = false;
     config.dry_run = true;
+    config.ninja = false;
     // try to avoid spurious failures in dist where we create/delete each others file
     let dir = config
         .out
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
index 8b8b01b1153..f549de6570f 100644
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
@@ -450,6 +450,7 @@ impl Config {
     pub fn default_opts() -> Config {
         let mut config = Config::default();
         config.llvm_optimize = true;
+        config.ninja = true;
         config.llvm_version_check = true;
         config.backtrace = true;
         config.rust_optimize = true;
diff --git a/src/bootstrap/sanity.rs b/src/bootstrap/sanity.rs
index f89bef50de9..533b5c79777 100644
--- a/src/bootstrap/sanity.rs
+++ b/src/bootstrap/sanity.rs
@@ -100,8 +100,16 @@ pub fn check(build: &mut Build) {
         if build.config.ninja {
             // Some Linux distros rename `ninja` to `ninja-build`.
             // CMake can work with either binary name.
-            if cmd_finder.maybe_have("ninja-build").is_none() {
-                cmd_finder.must_have("ninja");
+            if cmd_finder.maybe_have("ninja-build").is_none()
+                && cmd_finder.maybe_have("ninja").is_none()
+            {
+                eprintln!(
+                    "
+Couldn't find required command: ninja
+You should install ninja, or set ninja=false in config.toml
+"
+                );
+                std::process::exit(1);
             }
         }