Skip to content

Commit 88277f2

Browse files
committed
---
yaml --- r: 275320 b: refs/heads/stable c: f25f0e8 h: refs/heads/master
1 parent 464a7d0 commit 88277f2

File tree

87 files changed

+854
-364
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+854
-364
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: c0221c8897db309a79990367476177b1230bb264
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: 287eb2ac756bfe42fe2b8659ecb5d0547676a0b9
32+
refs/heads/stable: f25f0e8de91436fbf2630150d17569525e09bab6
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/src/bootstrap/Cargo.lock

Lines changed: 18 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

branches/stable/src/bootstrap/bootstrap.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ def download_rust_nightly(self):
7373

7474
if self.rustc().startswith(self.bin_root()) and \
7575
(not os.path.exists(self.rustc()) or self.rustc_out_of_date()):
76+
shutil.rmtree(self.bin_root())
7677
filename = "rust-std-nightly-" + self.build + ".tar.gz"
7778
url = "https://static.rust-lang.org/dist/" + self.snap_rustc_date()
7879
tarball = os.path.join(rustc_cache, filename)

branches/stable/src/bootstrap/build/compile.rs

Lines changed: 60 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,30 @@ pub fn std<'a>(build: &'a Build, stage: u32, target: &str,
5858
}
5959

6060
build.run(&mut cargo);
61+
std_link(build, stage, target, compiler, host);
62+
}
63+
64+
/// Link all libstd rlibs/dylibs into the sysroot location.
65+
///
66+
/// Links those artifacts generated in the given `stage` for `target` produced
67+
/// by `compiler` into `host`'s sysroot.
68+
pub fn std_link(build: &Build,
69+
stage: u32,
70+
target: &str,
71+
compiler: &Compiler,
72+
host: &str) {
73+
let libdir = build.sysroot_libdir(stage, host, target);
74+
let out_dir = build.cargo_out(stage, compiler.host, true, target);
75+
76+
// If we're linking one compiler host's output into another, then we weren't
77+
// called from the `std` method above. In that case we clean out what's
78+
// already there and then also link compiler-rt into place.
79+
if host != compiler.host {
80+
let _ = fs::remove_dir_all(&libdir);
81+
t!(fs::create_dir_all(&libdir));
82+
t!(fs::hard_link(&build.compiler_rt_built.borrow()[target],
83+
libdir.join(staticlib("compiler-rt", target))));
84+
}
6185
add_to_sysroot(&out_dir, &libdir);
6286
}
6387

@@ -99,7 +123,6 @@ pub fn rustc<'a>(build: &'a Build, stage: u32, target: &str,
99123
host, target);
100124

101125
let out_dir = build.cargo_out(stage, &host, false, target);
102-
let rustc = out_dir.join(exe("rustc", target));
103126
build.clear_if_dirty(&out_dir, &libstd_shim(build, stage, &host, target));
104127

105128
let mut cargo = build.cargo(stage, compiler, false, target, "build");
@@ -131,10 +154,13 @@ pub fn rustc<'a>(build: &'a Build, stage: u32, target: &str,
131154
if !build.unstable_features {
132155
cargo.env("CFG_DISABLE_UNSTABLE_FEATURES", "1");
133156
}
134-
if let Some(config) = build.config.target_config.get(target) {
135-
if let Some(ref s) = config.llvm_config {
136-
cargo.env("LLVM_CONFIG", s);
137-
}
157+
let target_config = build.config.target_config.get(target);
158+
if let Some(ref s) = target_config.and_then(|c| c.llvm_config.as_ref()) {
159+
cargo.env("LLVM_CONFIG", s);
160+
} else {
161+
let llvm_config = build.llvm_out(&build.config.build).join("bin")
162+
.join(exe("llvm-config", target));
163+
cargo.env("LLVM_CONFIG", llvm_config);
138164
}
139165
if build.config.llvm_static_stdcpp {
140166
cargo.env("LLVM_STATIC_STDCPP",
@@ -148,12 +174,21 @@ pub fn rustc<'a>(build: &'a Build, stage: u32, target: &str,
148174
}
149175
build.run(&mut cargo);
150176

151-
let sysroot_libdir = build.sysroot_libdir(stage, host, target);
152-
add_to_sysroot(&out_dir, &sysroot_libdir);
177+
rustc_link(build, stage, target, compiler, compiler.host);
178+
}
153179

154-
if host == target {
155-
assemble_compiler(build, stage, target, &rustc);
156-
}
180+
/// Link all librustc rlibs/dylibs into the sysroot location.
181+
///
182+
/// Links those artifacts generated in the given `stage` for `target` produced
183+
/// by `compiler` into `host`'s sysroot.
184+
pub fn rustc_link(build: &Build,
185+
stage: u32,
186+
target: &str,
187+
compiler: &Compiler,
188+
host: &str) {
189+
let libdir = build.sysroot_libdir(stage, host, target);
190+
let out_dir = build.cargo_out(stage, compiler.host, false, target);
191+
add_to_sysroot(&out_dir, &libdir);
157192
}
158193

159194
/// Cargo's output path for the standard library in a given stage, compiled
@@ -169,39 +204,42 @@ fn compiler_file(compiler: &Path, file: &str) -> String {
169204

170205
/// Prepare a new compiler from the artifacts in `stage`
171206
///
172-
/// This will link the compiler built by `host` during the stage
173-
/// specified to the sysroot location for `host` to be the official
174-
/// `stage + 1` compiler for that host. This means that the `rustc` binary
175-
/// itself will be linked into place along with all supporting dynamic
176-
/// libraries.
177-
fn assemble_compiler(build: &Build, stage: u32, host: &str, rustc: &Path) {
207+
/// This will assemble a compiler in `build/$host/stage$stage`. The compiler
208+
/// must have been previously produced by the `stage - 1` build.config.build
209+
/// compiler.
210+
pub fn assemble_rustc(build: &Build, stage: u32, host: &str) {
211+
assert!(stage > 0, "the stage0 compiler isn't assembled, it's downloaded");
212+
178213
// Clear out old files
179-
let sysroot = build.sysroot(stage + 1, host);
214+
let sysroot = build.sysroot(stage, host);
180215
let _ = fs::remove_dir_all(&sysroot);
181216
t!(fs::create_dir_all(&sysroot));
182217

183218
// Link in all dylibs to the libdir
184219
let sysroot_libdir = sysroot.join(libdir(host));
185220
t!(fs::create_dir_all(&sysroot_libdir));
186-
let src_libdir = build.sysroot_libdir(stage, host, host);
221+
let src_libdir = build.sysroot_libdir(stage - 1, &build.config.build, host);
187222
for f in t!(fs::read_dir(&src_libdir)).map(|f| t!(f)) {
188223
let filename = f.file_name().into_string().unwrap();
189224
if is_dylib(&filename) {
190225
t!(fs::hard_link(&f.path(), sysroot_libdir.join(&filename)));
191226
}
192227
}
193228

229+
let out_dir = build.cargo_out(stage - 1, &build.config.build, false, host);
230+
194231
// Link the compiler binary itself into place
232+
let rustc = out_dir.join(exe("rustc", host));
195233
let bindir = sysroot.join("bin");
196234
t!(fs::create_dir_all(&bindir));
197-
let compiler = build.compiler_path(&Compiler::new(stage + 1, host));
235+
let compiler = build.compiler_path(&Compiler::new(stage, host));
198236
let _ = fs::remove_file(&compiler);
199237
t!(fs::hard_link(rustc, compiler));
200238

201239
// See if rustdoc exists to link it into place
202-
let exe = exe("rustdoc", host);
203-
let rustdoc_src = rustc.parent().unwrap().join(&exe);
204-
let rustdoc_dst = bindir.join(exe);
240+
let rustdoc = exe("rustdoc", host);
241+
let rustdoc_src = out_dir.join(&rustdoc);
242+
let rustdoc_dst = bindir.join(&rustdoc);
205243
if fs::metadata(&rustdoc_src).is_ok() {
206244
let _ = fs::remove_file(&rustdoc_dst);
207245
t!(fs::hard_link(&rustdoc_src, &rustdoc_dst));
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
use std::path::Path;
12+
use std::fs::{self, File};
13+
use std::io::prelude::*;
14+
15+
use build::{Build, Compiler};
16+
use build::util::up_to_date;
17+
18+
pub fn rustbook(build: &Build, stage: u32, host: &str, name: &str, out: &Path) {
19+
t!(fs::create_dir_all(out));
20+
21+
let out = out.join(name);
22+
let compiler = Compiler::new(stage, host);
23+
let src = build.src.join("src/doc").join(name);
24+
let index = out.join("index.html");
25+
let rustbook = build.tool(&compiler, "rustbook");
26+
if up_to_date(&src, &index) && up_to_date(&rustbook, &index) {
27+
return
28+
}
29+
println!("Rustbook stage{} ({}) - {}", stage, host, name);
30+
let _ = fs::remove_dir_all(&out);
31+
build.run(build.tool_cmd(&compiler, "rustbook")
32+
.arg("build")
33+
.arg(&src)
34+
.arg(out));
35+
}
36+
37+
pub fn standalone(build: &Build, stage: u32, host: &str, out: &Path) {
38+
println!("Documenting stage{} standalone ({})", stage, host);
39+
t!(fs::create_dir_all(out));
40+
41+
let compiler = Compiler::new(stage, host);
42+
43+
let favicon = build.src.join("src/doc/favicon.inc");
44+
let footer = build.src.join("src/doc/footer.inc");
45+
let full_toc = build.src.join("src/doc/full-toc.inc");
46+
t!(fs::copy(build.src.join("src/doc/rust.css"), out.join("rust.css")));
47+
48+
let version_input = build.src.join("src/doc/version_info.html.template");
49+
let version_info = out.join("version_info.html");
50+
51+
if !up_to_date(&version_input, &version_info) {
52+
let mut info = String::new();
53+
t!(t!(File::open(&version_input)).read_to_string(&mut info));
54+
let blank = String::new();
55+
let short = build.short_ver_hash.as_ref().unwrap_or(&blank);
56+
let hash = build.ver_hash.as_ref().unwrap_or(&blank);
57+
let info = info.replace("VERSION", &build.release)
58+
.replace("SHORT_HASH", short)
59+
.replace("STAMP", hash);
60+
t!(t!(File::create(&version_info)).write_all(info.as_bytes()));
61+
}
62+
63+
for file in t!(fs::read_dir(build.src.join("src/doc"))) {
64+
let file = t!(file);
65+
let path = file.path();
66+
let filename = path.file_name().unwrap().to_str().unwrap();
67+
if !filename.ends_with(".md") || filename == "README.md" {
68+
continue
69+
}
70+
71+
let html = out.join(filename).with_extension("html");
72+
let rustdoc = build.tool(&compiler, "rustdoc");
73+
if up_to_date(&path, &html) &&
74+
up_to_date(&footer, &html) &&
75+
up_to_date(&favicon, &html) &&
76+
up_to_date(&full_toc, &html) &&
77+
up_to_date(&version_info, &html) &&
78+
up_to_date(&rustdoc, &html) {
79+
continue
80+
}
81+
82+
let mut cmd = build.tool_cmd(&compiler, "rustdoc");
83+
cmd.arg("--html-after-content").arg(&footer)
84+
.arg("--html-before-content").arg(&version_info)
85+
.arg("--html-in-header").arg(&favicon)
86+
.arg("--markdown-playground-url")
87+
.arg("https://play.rust-lang.org/")
88+
.arg("-o").arg(out)
89+
.arg(&path);
90+
91+
if filename == "reference.md" {
92+
cmd.arg("--html-in-header").arg(&full_toc);
93+
}
94+
95+
if filename == "not_found.md" {
96+
cmd.arg("--markdown-no-toc")
97+
.arg("--markdown-css")
98+
.arg("https://doc.rust-lang.org/rust.css");
99+
} else {
100+
cmd.arg("--markdown-css").arg("rust.css");
101+
}
102+
build.run(&mut cmd);
103+
}
104+
}

0 commit comments

Comments
 (0)