Skip to content

Commit e4d68e8

Browse files
committed
Tweak with the diagram a little more
1 parent caac2dc commit e4d68e8

File tree

4 files changed

+116
-1
lines changed

4 files changed

+116
-1
lines changed

README.md

+18
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,24 @@ and execute the following command in the root of the repository:
7676

7777
The build files are found in the `book` directory.
7878

79+
### Regenerating `stages.png`
80+
81+
This requires a LaTeX toolchain installed.
82+
On Debian-based distros you can install it with
83+
```
84+
$ sudo apt install texlive-latex-base
85+
```
86+
87+
Then run
88+
```
89+
$ pdflatex -output-directory=target src/building/stages.tex
90+
```
91+
92+
and take a screenshot of the resulting PDF in your browser:
93+
```
94+
$ x-www-browser target/stages.pdf
95+
```
96+
7997
### Link Validations
8098

8199
We use `mdbook-linkcheck` to validate URLs included in our documentation. To perform link checks, uncomment the `[output.linkcheck]` field in the `book.toml` configuration file and install `mdbook-linkcheck` with:

src/building/bootstrapping.md

+19-1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,23 @@ row 2 and column 1. This corresponds to the `build-stage` diagram.
7575
Building any of the items in the diagram also requires first building all
7676
items with arrows pointing to it.
7777

78+
The diagram just says `rustc` for simplicity, but this also includes all
79+
programs linked to rustc:
80+
81+
- `rustdoc`
82+
- `rustfmt`
83+
- `clippy`
84+
- `miri`
85+
- compiler plugins
86+
87+
Similarly, `std` refers to the whole standard library:
88+
89+
- `core`
90+
- `alloc`
91+
- `std`
92+
- `test`
93+
- `proc_macro`
94+
7895
### What are `run-stage` and `build-stage`?
7996

8097
`run-stage` means that this deals with _running_ the compiler,
@@ -195,7 +212,8 @@ Keep in mind this diagram is a simplification, i.e. `rustdoc` can be built at
195212
different stages, the process is a bit different when passing flags such as
196213
`--keep-stage`, or if there are non-host targets.
197214

198-
The following tables indicate the outputs of various stage actions:
215+
The following tables indicate the outputs of various stage actions
216+
(in this context, 'stage' refers to `build-stage`):
199217

200218
| Stage 0 Action | Output |
201219
|-----------------------------------------------------------|----------------------------------------------|

src/building/stages.png

7.45 KB
Loading

src/building/stages.tex

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
\documentclass{standalone}
2+
3+
\usepackage{tikz}
4+
\usetikzlibrary{arrows.meta}
5+
6+
\begin{document}
7+
8+
\noindent
9+
\begin{tikzpicture}
10+
11+
\node[text width=5in] at (2.5, 2) {
12+
\noindent Arrows represent build dependencies.
13+
Columns are things that are linked together.
14+
Rows are things that can be used together to build a program.
15+
\\
16+
17+
\noindent \verb|./x.py build --stage N| builds programs in \emph{column} \verb|N| (except rustdoc - it builds rustdoc from column \verb|N + 1|).\\
18+
\noindent \verb|./x.py test --stage N| builds and tests everything in \emph{row} \verb|N|.\\
19+
\noindent \verb|./x.py doc --stage N| generates docs with rustdoc from \emph{row} \verb|N|.\\
20+
};
21+
22+
\draw[draw=black,fill=white,fill opacity=0.5] (-3, -0.5) rectangle ++(12, 1);
23+
\draw[fill=teal,fill opacity=0.5] (-3, -1.5) rectangle ++(12, 1);
24+
\draw[fill=olive,fill opacity=0.5] (-3, -2.5) rectangle ++(12, 1);
25+
\draw[fill=pink,fill opacity=0.5] (-3, -3.5) rectangle ++(12, 1);
26+
27+
\draw[draw=black,fill=white,fill opacity=0.5] (1, 0.5) rectangle ++(2, -5);
28+
\draw[fill=teal,fill opacity=0.5] (3, 0.5) rectangle ++(2, -5);
29+
\draw[fill=olive,fill opacity=0.5] (5, 0.5) rectangle ++(2, -5);
30+
\draw[fill=pink,fill opacity=0.5] (7, 0.5) rectangle ++(2, -5);
31+
32+
\node[rotate=90] at (-3.5, -1.5) {run-stage};
33+
34+
\node[] at (-2, 0) {stage 0};
35+
\node[] at (-2, -1) {stage 1};
36+
\node[] at (-2, -2) {stage 2};
37+
\node[] at (-2, -3) {stage 3};
38+
39+
\node[] at (5, -5) {build-stage};
40+
41+
\node[] at (2, -4) {stage 0};
42+
\node[] at (4, -4) {stage 1};
43+
\node[] at (6, -4) {stage 2};
44+
\node[] at (8, -4) {stage 3};
45+
46+
\begin{scope}[every node/.style={thick,draw,fill=white}]
47+
\node (s0r) at (0,0) {beta rustc};
48+
\node (s0s) at (2,0) {std};
49+
\node (s1r) at (2,-1) {rustc};
50+
\node (s1s) at (4,-1) {std};
51+
\node (s2r) at (4,-2) {rustc};
52+
\node (s2s) at (6,-2) {std};
53+
\node (s3r) at (6,-3) {rustc};
54+
\node (s3s) at (8,-3) {std};
55+
\end{scope}
56+
57+
\begin{scope}[>={Stealth[black]}, every edge/.style={draw=black,very thick}]
58+
\path [->] (s0r) edge node {} (s0s);
59+
\path [->] (s0r) edge node {} (s1r);
60+
\path [->] (s0s) edge node {} (s1r);
61+
\path [->] (s1r) edge node {} (s1s);
62+
\path [->] (s1r) edge node {} (s2r);
63+
\path [->] (s1s) edge node {} (s2r);
64+
\path [->] (s2r) edge node {} (s2s);
65+
\path [->] (s2r) edge node {} (s3r);
66+
\path [->] (s2s) edge node {} (s3r);
67+
\path [->] (s3r) edge node {} (s3s);
68+
\end{scope}
69+
70+
\node[text width=5in] at (2.5, -6) {
71+
\noindent \verb|build| excludes \verb|rustc| by default.
72+
73+
Use \verb|build --stage N src/rustc| to build the \verb|rustc| in \emph{column}
74+
\verb|N|.
75+
};
76+
77+
\end{tikzpicture}
78+
79+
\end{document}

0 commit comments

Comments
 (0)