summaryrefslogtreecommitdiffstats
path: root/testing/source/rust/0001-WIP-minimize-the-rust-std-component.patch
blob: e46a7265c41ca6a203469ba85adcb53d1686094f (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
--- ./src/bootstrap/dist.rs.orig	2019-11-07 16:25:16.099477103 -0600
+++ ./src/bootstrap/dist.rs	2019-11-07 16:31:36.510445625 -0600
@@ -675,36 +675,28 @@
             return distdir(builder).join(format!("{}-{}.tar.gz", name, target));
         }
 
-        // We want to package up as many target libraries as possible
-        // for the `rust-std` package, so if this is a host target we
-        // depend on librustc and otherwise we just depend on libtest.
-        if builder.hosts.iter().any(|t| t == target) {
-            builder.ensure(compile::Rustc { compiler, target });
-        } else {
-            builder.ensure(compile::Std { compiler, target });
-        }
+        builder.ensure(compile::Std { compiler, target });
+        builder.ensure(compile::Rustc { compiler, target });
 
         let image = tmpdir(builder).join(format!("{}-{}-image", name, target));
         let _ = fs::remove_dir_all(&image);
 
-        let dst = image.join("lib/rustlib").join(target);
+        let dst = image.join("lib/rustlib").join(target).join("lib");
         t!(fs::create_dir_all(&dst));
-        let mut src = builder.sysroot_libdir(compiler, target).to_path_buf();
-        src.pop(); // Remove the trailing /lib folder from the sysroot_libdir
-        builder.cp_filtered(&src, &dst, &|path| {
-            if let Some(name) = path.file_name().and_then(|s| s.to_str()) {
-                if name == builder.config.rust_codegen_backends_dir.as_str() {
-                    return false
-                }
-                if name == "bin" {
-                    return false
-                }
-                if name.contains("LLVM") {
-                    return false
-                }
+
+        let compiler_to_use = builder.compiler_for(compiler.stage, compiler.host, target);
+        let stamp = dbg!(compile::libstd_stamp(builder, compiler_to_use, target));
+        for (path, host) in builder.read_stamp_file(&stamp) {
+            if !host {
+                builder.copy(&path, &dst.join(path.file_name().unwrap()));
             }
-            true
-        });
+        }
+        let stamp = dbg!(compile::librustc_stamp(builder, compiler_to_use, target));
+        for (path, host) in builder.read_stamp_file(&stamp) {
+            if !host {
+                builder.copy(&path, &dst.join(path.file_name().unwrap()));
+            }
+        }
 
         let mut cmd = rust_installer(builder);
         cmd.arg("generate")