]> git.lizzy.rs Git - rust.git/blobdiff - src/bootstrap/lib.rs
Add a new wasm32-unknown-wasi target
[rust.git] / src / bootstrap / lib.rs
index 976b30a55c94b7d8db3e09a705069622ebfc9ade..167455af1f2e64815ee0257223ef378e52449b4a 100644 (file)
@@ -190,6 +190,7 @@ pub unsafe fn setup(_build: &mut crate::Build) {
     "llvm-readobj", // used to get information from ELFs/objects that the other tools don't provide
     "llvm-size", // used to prints the size of the linker sections of a program
     "llvm-strip", // used to discard symbols from binary files to reduce their size
+    "llvm-ar" // used for creating and modifying archive files
 ];
 
 /// A structure representing a Rust compiler.
@@ -726,6 +727,17 @@ fn verbose(&self, msg: &str) {
         }
     }
 
+    pub fn is_verbose_than(&self, level: usize) -> bool {
+        self.verbosity > level
+    }
+
+    /// Prints a message if this build is configured in more verbose mode than `level`.
+    fn verbose_than(&self, level: usize, msg: &str) {
+        if self.is_verbose_than(level) {
+            println!("{}", msg);
+        }
+    }
+
     fn info(&self, msg: &str) {
         if self.config.dry_run { return; }
         println!("{}", msg);
@@ -849,6 +861,13 @@ fn musl_root(&self, target: Interned<String>) -> Option<&Path> {
             .map(|p| &**p)
     }
 
+    /// Returns the sysroot for the wasi target, if defined
+    fn wasi_root(&self, target: Interned<String>) -> Option<&Path> {
+        self.config.target_config.get(&target)
+            .and_then(|t| t.wasi_root.as_ref())
+            .map(|p| &**p)
+    }
+
     /// Returns `true` if this is a no-std `target`, if defined
     fn no_std(&self, target: Interned<String>) -> Option<bool> {
         self.config.target_config.get(&target)
@@ -1158,6 +1177,7 @@ fn read_stamp_file(&self, stamp: &Path) -> Vec<(PathBuf, bool)> {
     /// Copies a file from `src` to `dst`
     pub fn copy(&self, src: &Path, dst: &Path) {
         if self.config.dry_run { return; }
+        self.verbose_than(1, &format!("Copy {:?} to {:?}", src, dst));
         let _ = fs::remove_file(&dst);
         let metadata = t!(src.symlink_metadata());
         if metadata.file_type().is_symlink() {