1 |
From 2bf05f208272cd58c57f4d7d8d0e10fdb22e8719 Mon Sep 17 00:00:00 2001 |
2 |
From: Josh Stone <jistone@redhat.com> |
3 |
Date: Fri, 27 Sep 2019 12:33:08 -0700 |
4 |
Subject: [PATCH] [WIP] minimize the rust-std component |
5 |
|
6 |
--- |
7 |
src/bootstrap/dist.rs | 45 +++++++++++++++---------------------------- |
8 |
1 file changed, 16 insertions(+), 29 deletions(-) |
9 |
|
10 |
diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs |
11 |
index 552965863d10..76fbd07f9fb5 100644 |
12 |
--- a/src/bootstrap/dist.rs |
13 |
+++ b/src/bootstrap/dist.rs |
14 |
@@ -667,41 +667,28 @@ impl Step for Std { |
15 |
return distdir(builder).join(format!("{}-{}.tar.gz", name, target)); |
16 |
} |
17 |
|
18 |
- // We want to package up as many target libraries as possible |
19 |
- // for the `rust-std` package, so if this is a host target we |
20 |
- // depend on librustc and otherwise we just depend on libtest. |
21 |
- if builder.hosts.iter().any(|t| t == target) { |
22 |
- builder.ensure(compile::Rustc { compiler, target }); |
23 |
- } else { |
24 |
- if builder.no_std(target) == Some(true) { |
25 |
- // the `test` doesn't compile for no-std targets |
26 |
- builder.ensure(compile::Std { compiler, target }); |
27 |
- } else { |
28 |
- builder.ensure(compile::Test { compiler, target }); |
29 |
- } |
30 |
- } |
31 |
+ builder.ensure(compile::Std { compiler, target }); |
32 |
+ builder.ensure(compile::Test { compiler, target }); |
33 |
|
34 |
let image = tmpdir(builder).join(format!("{}-{}-image", name, target)); |
35 |
let _ = fs::remove_dir_all(&image); |
36 |
|
37 |
- let dst = image.join("lib/rustlib").join(target); |
38 |
+ let dst = image.join("lib/rustlib").join(target).join("lib"); |
39 |
t!(fs::create_dir_all(&dst)); |
40 |
- let mut src = builder.sysroot_libdir(compiler, target).to_path_buf(); |
41 |
- src.pop(); // Remove the trailing /lib folder from the sysroot_libdir |
42 |
- builder.cp_filtered(&src, &dst, &|path| { |
43 |
- if let Some(name) = path.file_name().and_then(|s| s.to_str()) { |
44 |
- if name == builder.config.rust_codegen_backends_dir.as_str() { |
45 |
- return false |
46 |
- } |
47 |
- if name == "bin" { |
48 |
- return false |
49 |
- } |
50 |
- if name.contains("LLVM") { |
51 |
- return false |
52 |
- } |
53 |
+ |
54 |
+ let compiler_to_use = builder.compiler_for(compiler.stage, compiler.host, target); |
55 |
+ let stamp = dbg!(compile::libstd_stamp(builder, compiler_to_use, target)); |
56 |
+ for (path, host) in builder.read_stamp_file(&stamp) { |
57 |
+ if !host { |
58 |
+ builder.copy(&path, &dst.join(path.file_name().unwrap())); |
59 |
} |
60 |
- true |
61 |
- }); |
62 |
+ } |
63 |
+ let stamp = dbg!(compile::libtest_stamp(builder, compiler_to_use, target)); |
64 |
+ for (path, host) in builder.read_stamp_file(&stamp) { |
65 |
+ if !host { |
66 |
+ builder.copy(&path, &dst.join(path.file_name().unwrap())); |
67 |
+ } |
68 |
+ } |
69 |
|
70 |
let mut cmd = rust_installer(builder); |
71 |
cmd.arg("generate") |
72 |
-- |
73 |
2.21.0 |
74 |
|