about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2017-08-07 22:30:39 -0700
committerAlex Crichton <alex@alexcrichton.com>2017-08-09 11:44:21 -0700
commitc25ddf21f18c3eeeaea2a4dffd70d2f6183068b5 (patch)
tree9715e57405ae14bd7877dec129bce733daf72dc1 /src/bootstrap
parentcc4ff8f4d169562ff4ae22b94197a191215e6d56 (diff)
parentc5e2051f070c01241f68720a92a0957bcb070597 (diff)
downloadrust-c25ddf21f18c3eeeaea2a4dffd70d2f6183068b5.tar.gz
rust-c25ddf21f18c3eeeaea2a4dffd70d2f6183068b5.zip
Merge remote-tracking branch 'origin/master' into gen
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/bin/rustc.rs2
-rw-r--r--src/bootstrap/builder.rs4
-rw-r--r--src/bootstrap/check.rs80
-rw-r--r--src/bootstrap/config.rs4
-rw-r--r--src/bootstrap/config.toml.example7
-rw-r--r--src/bootstrap/native.rs24
6 files changed, 39 insertions, 82 deletions
diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs
index ac2e3bc402a..f6ed4ee91b3 100644
--- a/src/bootstrap/bin/rustc.rs
+++ b/src/bootstrap/bin/rustc.rs
@@ -188,7 +188,7 @@ fn main() {
             cmd.arg("-Zsave-analysis");
             cmd.env("RUST_SAVE_ANALYSIS_CONFIG",
                     "{\"output_file\": null,\"full_docs\": false,\"pub_only\": true,\
-                     \"signatures\": false,\"borrow_data\": false}");
+                     \"distro_crate\": true,\"signatures\": false,\"borrow_data\": false}");
         }
 
         // Dealing with rpath here is a little special, so let's go into some
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index 2f6e3ca9253..811c7df5d99 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -28,6 +28,7 @@ use check;
 use flags::Subcommand;
 use doc;
 use tool;
+use native;
 
 pub use Compiler;
 
@@ -256,7 +257,8 @@ impl<'a> Builder<'a> {
                 compile::StartupObjects, tool::BuildManifest, tool::Rustbook, tool::ErrorIndex,
                 tool::UnstableBookGen, tool::Tidy, tool::Linkchecker, tool::CargoTest,
                 tool::Compiletest, tool::RemoteTestServer, tool::RemoteTestClient,
-                tool::RustInstaller, tool::Cargo, tool::Rls, tool::Rustdoc),
+                tool::RustInstaller, tool::Cargo, tool::Rls, tool::Rustdoc,
+                native::Llvm),
             Kind::Test => describe!(check::Tidy, check::Bootstrap, check::DefaultCompiletest,
                 check::HostCompiletest, check::Crate, check::CrateLibrustc, check::Linkcheck,
                 check::Cargotest, check::Cargo, check::Rls, check::Docs, check::ErrorIndex,
diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs
index b04e4de7744..c65f5a9fb48 100644
--- a/src/bootstrap/check.rs
+++ b/src/bootstrap/check.rs
@@ -1050,11 +1050,8 @@ impl Step for Crate {
         dylib_path.insert(0, PathBuf::from(&*builder.sysroot_libdir(compiler, target)));
         cargo.env(dylib_path_var(), env::join_paths(&dylib_path).unwrap());
 
-        if target.contains("emscripten") || build.remote_tested(target) {
-            cargo.arg("--no-run");
-        }
-
         cargo.arg("--");
+        cargo.args(&build.flags.cmd.test_args());
 
         if build.config.quiet_tests {
             cargo.arg("--quiet");
@@ -1063,75 +1060,24 @@ impl Step for Crate {
         let _time = util::timeit();
 
         if target.contains("emscripten") {
-            build.run(&mut cargo);
-            krate_emscripten(build, compiler, target, mode);
+            cargo.env(format!("CARGO_TARGET_{}_RUNNER", envify(&target)),
+                      build.config.nodejs.as_ref().expect("nodejs not configured"));
         } else if build.remote_tested(target) {
-            build.run(&mut cargo);
-            krate_remote(builder, compiler, target, mode);
-        } else {
-            cargo.args(&build.flags.cmd.test_args());
-            try_run(build, &mut cargo);
-        }
-    }
-}
-
-fn krate_emscripten(build: &Build,
-                    compiler: Compiler,
-                    target: Interned<String>,
-                    mode: Mode) {
-    let out_dir = build.cargo_out(compiler, mode, target);
-    let tests = find_tests(&out_dir.join("deps"), target);
-
-    let nodejs = build.config.nodejs.as_ref().expect("nodejs not configured");
-    for test in tests {
-        println!("running {}", test.display());
-        let mut cmd = Command::new(nodejs);
-        cmd.arg(&test);
-        if build.config.quiet_tests {
-            cmd.arg("--quiet");
-        }
-        try_run(build, &mut cmd);
-    }
-}
-
-fn krate_remote(builder: &Builder,
-                compiler: Compiler,
-                target: Interned<String>,
-                mode: Mode) {
-    let build = builder.build;
-    let out_dir = build.cargo_out(compiler, mode, target);
-    let tests = find_tests(&out_dir.join("deps"), target);
-
-    let tool = builder.tool_exe(Tool::RemoteTestClient);
-    for test in tests {
-        let mut cmd = Command::new(&tool);
-        cmd.arg("run")
-           .arg(&test);
-        if build.config.quiet_tests {
-            cmd.arg("--quiet");
+            cargo.env(format!("CARGO_TARGET_{}_RUNNER", envify(&target)),
+                      format!("{} run",
+                              builder.tool_exe(Tool::RemoteTestClient).display()));
         }
-        cmd.args(&build.flags.cmd.test_args());
-        try_run(build, &mut cmd);
+        try_run(build, &mut cargo);
     }
 }
 
-fn find_tests(dir: &Path, target: Interned<String>) -> Vec<PathBuf> {
-    let mut dst = Vec::new();
-    for e in t!(dir.read_dir()).map(|e| t!(e)) {
-        let file_type = t!(e.file_type());
-        if !file_type.is_file() {
-            continue
-        }
-        let filename = e.file_name().into_string().unwrap();
-        if (target.contains("windows") && filename.ends_with(".exe")) ||
-           (!target.contains("windows") && !filename.contains(".")) ||
-           (target.contains("emscripten") &&
-            filename.ends_with(".js") &&
-            !filename.ends_with(".asm.js")) {
-            dst.push(e.path());
+fn envify(s: &str) -> String {
+    s.chars().map(|c| {
+        match c {
+            '-' => '_',
+            c => c,
         }
-    }
-    dst
+    }).flat_map(|c| c.to_uppercase()).collect()
 }
 
 /// Some test suites are run inside emulators or on remote devices, and most
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
index 7b8af436d5a..5d898cb716d 100644
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
@@ -62,7 +62,6 @@ pub struct Config {
     pub llvm_targets: Option<String>,
     pub llvm_experimental_targets: Option<String>,
     pub llvm_link_jobs: Option<u32>,
-    pub llvm_clean_rebuild: bool,
 
     // rust codegen options
     pub rust_optimize: bool,
@@ -203,7 +202,6 @@ struct Llvm {
     targets: Option<String>,
     experimental_targets: Option<String>,
     link_jobs: Option<u32>,
-    clean_rebuild: Option<bool>,
 }
 
 #[derive(Deserialize, Default, Clone)]
@@ -352,7 +350,6 @@ impl Config {
             set(&mut config.llvm_release_debuginfo, llvm.release_debuginfo);
             set(&mut config.llvm_version_check, llvm.version_check);
             set(&mut config.llvm_static_stdcpp, llvm.static_libstdcpp);
-            set(&mut config.llvm_clean_rebuild, llvm.clean_rebuild);
             config.llvm_targets = llvm.targets.clone();
             config.llvm_experimental_targets = llvm.experimental_targets.clone();
             config.llvm_link_jobs = llvm.link_jobs;
@@ -477,7 +474,6 @@ impl Config {
                 ("LLVM_VERSION_CHECK", self.llvm_version_check),
                 ("LLVM_STATIC_STDCPP", self.llvm_static_stdcpp),
                 ("LLVM_LINK_SHARED", self.llvm_link_shared),
-                ("LLVM_CLEAN_REBUILD", self.llvm_clean_rebuild),
                 ("OPTIMIZE", self.rust_optimize),
                 ("DEBUG_ASSERTIONS", self.rust_debug_assertions),
                 ("DEBUGINFO", self.rust_debuginfo),
diff --git a/src/bootstrap/config.toml.example b/src/bootstrap/config.toml.example
index 7a52222e46e..9314135050f 100644
--- a/src/bootstrap/config.toml.example
+++ b/src/bootstrap/config.toml.example
@@ -69,11 +69,6 @@
 # controlled by rustbuild's -j parameter.
 #link-jobs = 0
 
-# Delete LLVM build directory on LLVM rebuild.
-# This option defaults to `false` for local development, but CI may want to
-# always perform clean full builds (possibly accelerated by (s)ccache).
-#clean-rebuild = false
-
 # =============================================================================
 # General build configuration options
 # =============================================================================
@@ -208,7 +203,7 @@
 #codegen-units = 1
 
 # Whether or not debug assertions are enabled for the compiler and standard
-# library
+# library. Also enables compilation of debug! and trace! logging macros.
 #debug-assertions = false
 
 # Whether or not debuginfo is emitted
diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs
index f0dfd857ab6..ee0eca5d482 100644
--- a/src/bootstrap/native.rs
+++ b/src/bootstrap/native.rs
@@ -48,6 +48,10 @@ impl Step for Llvm {
         run.path("src/llvm")
     }
 
+    fn make_run(run: RunConfig) {
+        run.builder.ensure(Llvm { target: run.target })
+    }
+
     /// Compile LLVM for `target`.
     fn run(self, builder: &Builder) {
         let build = builder.build;
@@ -76,9 +80,6 @@ impl Step for Llvm {
                 return
             }
         }
-        if build.config.llvm_clean_rebuild {
-            drop(fs::remove_dir_all(&out_dir));
-        }
 
         let _folder = build.fold_output(|| "llvm");
         println!("Building LLVM for {}", target);
@@ -128,6 +129,15 @@ impl Step for Llvm {
            .define("LLVM_TARGET_ARCH", target.split('-').next().unwrap())
            .define("LLVM_DEFAULT_TARGET_TRIPLE", target);
 
+
+        // This setting makes the LLVM tools link to the dynamic LLVM library,
+        // which saves both memory during parallel links and overall disk space
+        // for the tools.  We don't distribute any of those tools, so this is
+        // just a local concern.  However, it doesn't work well everywhere.
+        if target.contains("linux-gnu") || target.contains("apple-darwin") {
+           cfg.define("LLVM_LINK_LLVM_DYLIB", "ON");
+        }
+
         if target.contains("msvc") {
             cfg.define("LLVM_USE_CRT_DEBUG", "MT");
             cfg.define("LLVM_USE_CRT_RELEASE", "MT");
@@ -154,6 +164,14 @@ impl Step for Llvm {
             let host = build.llvm_out(build.build).join("bin/llvm-tblgen");
             cfg.define("CMAKE_CROSSCOMPILING", "True")
                .define("LLVM_TABLEGEN", &host);
+
+            if target.contains("netbsd") {
+               cfg.define("CMAKE_SYSTEM_NAME", "NetBSD");
+            } else if target.contains("freebsd") {
+               cfg.define("CMAKE_SYSTEM_NAME", "FreeBSD");
+            }
+
+            cfg.define("LLVM_NATIVE_BUILD", build.llvm_out(build.build).join("build"));
         }
 
         let sanitize_cc = |cc: &Path| {