@@ -28,14 +28,14 @@ compiler. What actually happens when you invoke bootstrap is:
2828 ` x.py ` cross-platform) is run. This script is responsible for downloading the stage0
2929 compiler/Cargo binaries, and it then compiles the build system itself (this folder).
3030 Finally, it then invokes the actual ` bootstrap ` binary build system.
31- 2 . In Rust, ` bootstrap ` will slurp up all configuration, perform a number of
32- sanity checks (whether compilers exist, for example ), and then start building the
33- stage0 artifacts .
34- 3 . The stage0 ` cargo ` , downloaded earlier, is used to build the standard library
35- and the compiler, and then these binaries are then copied to the ` stage1 `
36- directory. That compiler is then used to generate the stage1 artifacts which
37- are then copied to the stage2 directory, and then finally, the stage2
38- artifacts are generated using that compiler .
31+ 2 . In Rust, the bootstrap binary reads all configuration, performs a number of sanity
32+ checks (for example, verifying toolchains and paths ), and then prepares to build the
33+ stage 1 compiler and libraries using the prebuilt stage 0 compiler .
34+ 3 . The stage 0 compiler and standard library , downloaded earlier, are used to build the
35+ stage 1 compiler, which links against the beta standard library. The newly built stage 1
36+ compiler is then used to build the stage 1 standard library. After that, the stage 1
37+ compiler is used once more to produce the stage 2 compiler, which links against the
38+ stage 1 standard library .
3939
4040The goal of each stage is to (a) leverage Cargo as much as possible and failing
4141that (b) leverage Rust as much as possible!
@@ -120,44 +120,12 @@ build/
120120 debuginfo/
121121 ...
122122
123- # Host tools (which are always compiled with the stage0 compiler)
124- # are stored here.
125- bootstrap-tools/
126-
127123 # Location where the stage0 Cargo and Rust compiler are unpacked. This
128124 # directory is purely an extracted and overlaid tarball of these two (done
129125 # by the bootstrap Python script). In theory, the build system does not
130126 # modify anything under this directory afterwards.
131127 stage0/
132128
133- # These to-build directories are the cargo output directories for builds of
134- # the standard library, the test system, the compiler, and various tools,
135- # respectively. Internally, these may also
136- # have other target directories, which represent artifacts being compiled
137- # from the host to the specified target.
138- #
139- # Essentially, each of these directories is filled in by one `cargo`
140- # invocation. The build system instruments calling Cargo in the right order
141- # with the right variables to ensure that these are filled in correctly.
142- stageN-std/
143- stageN-test/
144- stageN-rustc/
145- stageN-tools/
146-
147- # This is a special case of the above directories, **not** filled in via
148- # Cargo but rather the build system itself. The stage0 compiler already has
149- # a set of target libraries for its own host triple (in its own sysroot)
150- # inside of stage0/. When we run the stage0 compiler to bootstrap more
151- # things, however, we don't want to use any of these libraries (as those are
152- # the ones that we're building). So essentially, when the stage1 compiler is
153- # being compiled (e.g. after libstd has been built), *this* is used as the
154- # sysroot for the stage0 compiler being run.
155- #
156- # Basically, this directory is just a temporary artifact used to configure the
157- # stage0 compiler to ensure that the libstd that we just built is used to
158- # compile the stage1 compiler.
159- stage0-sysroot/lib/
160-
161129 # These output directories are intended to be standalone working
162130 # implementations of the compiler (corresponding to each stage). The build
163131 # system will link (using hard links) output from stageN-{std,rustc} into
@@ -167,7 +135,6 @@ build/
167135 # no extra build output in these directories.
168136 stage1/
169137 stage2/
170- stage3/
171138```
172139
173140## Extending bootstrap
@@ -177,8 +144,9 @@ When you use bootstrap, you'll call it through the entry point script
177144` bootstrap ` has a difficult problem: it is written in Rust, but yet it is run
178145before the Rust compiler is built! To work around this, there are two components
179146of bootstrap: the main one written in rust, and ` bootstrap.py ` . ` bootstrap.py `
180- is what gets run by entry point script. It takes care of downloading the ` stage0 `
181- compiler, which will then build the bootstrap binary written in Rust.
147+ is what gets run by entry point script. It takes care of downloading the prebuilt
148+ stage 0 compiler, std and Cargo binaries, which are then used to build the
149+ bootstrap binary.
182150
183151Because there are two separate codebases behind ` x.py ` , they need to
184152be kept in sync. In particular, both ` bootstrap.py ` and the bootstrap binary
0 commit comments