Skip to content

Commit 9ae9880

Browse files
authored
Rollup merge of rust-lang#105465 - jyn514:docs, r=Mark-Simulacrum
Improve top-level docs See a detailed explanation in the commit messages. This is a companion PR to rust-lang/rustc-dev-guide#1528. * Link to other resources instead of inlining their information * Remove ancient and outdated reference to `config.mk` * Suggest `profile = "user"` in the README * Add detail about dependencies from the dev-guide * Link to CONTRIBUTING.md instead of rustc-dev-guide in the main readme * Link to `std-dev-guide` in CONTRIBUTING.md
2 parents 4f4d058 + 70a0e0a commit 9ae9880

File tree

4 files changed

+62
-69
lines changed

4 files changed

+62
-69
lines changed

CONTRIBUTING.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ members](https://rust-lang.zulipchat.com/#narrow/stream/122652-new-members)
88
Zulip stream. We have lots of docs below of how to get started on your own, but
99
the Zulip stream is the best place to *ask* for help.
1010

11-
Documentation for contributing to Rust is located in the [Guide to Rustc Development](https://rustc-dev-guide.rust-lang.org/),
12-
commonly known as the [rustc-dev-guide]. Despite the name, this guide documents
13-
not just how to develop rustc (the Rust compiler), but also how to contribute to the standard library and rustdoc.
11+
Documentation for contributing to the compiler or tooling is located in the [Guide to Rustc
12+
Development][rustc-dev-guide], commonly known as the [rustc-dev-guide]. Documentation for the
13+
standard library in the [Standard library developers Guide][std-dev-guide], commonly known as the [std-dev-guide].
1414

1515
## About the [rustc-dev-guide]
1616

@@ -35,6 +35,7 @@ refer to [this section][contributing-bug-reports] and [open an issue][issue temp
3535

3636
[Contributing to Rust]: https://rustc-dev-guide.rust-lang.org/contributing.html#contributing-to-rust
3737
[rustc-dev-guide]: https://rustc-dev-guide.rust-lang.org/
38+
[std-dev-guide]: https://std-dev-guide.rust-lang.org/
3839
[contributing-bug-reports]: https://rustc-dev-guide.rust-lang.org/contributing.html#bug-reports
3940
[issue template]: https://github.com/rust-lang/rust/issues/new/choose
4041
[internals]: https://internals.rust-lang.org

README.md

+55-54
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,7 @@ standard library, and documentation.
66
[Rust]: https://www.rust-lang.org
77

88
**Note: this README is for _users_ rather than _contributors_.
9-
If you wish to _contribute_ to the compiler, you should read the
10-
[Getting Started][gettingstarted] section of the rustc-dev-guide instead.
11-
You can ask for help in the [#new members Zulip stream][new-members].**
12-
13-
[new-members]: https://rust-lang.zulipchat.com/#narrow/stream/122652-new-members
9+
If you wish to _contribute_ to the compiler, you should read [CONTRIBUTING.md](CONTRIBUTING.md) instead.
1410

1511
## Quick Start
1612

@@ -48,20 +44,37 @@ by running it with the `--help` flag or reading the [rustc dev guide][rustcguide
4844
[gettingstarted]: https://rustc-dev-guide.rust-lang.org/getting-started.html
4945
[rustcguidebuild]: https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html
5046

51-
### Building on a Unix-like system
52-
1. Make sure you have installed the dependencies:
47+
### Dependencies
48+
49+
Make sure you have installed the dependencies:
5350

54-
* `g++` 5.1 or later or `clang++` 3.5 or later
5551
* `python` 3 or 2.7
56-
* GNU `make` 3.81 or later
57-
* `cmake` 3.13.4 or later
58-
* `ninja`
59-
* `curl`
6052
* `git`
61-
* `ssl` which comes in `libssl-dev` or `openssl-devel`
53+
* A C compiler (when building for the host, `cc` is enough; cross-compiling may need additional compilers)
54+
* `curl` (not needed on Windows)
6255
* `pkg-config` if you are compiling on Linux and targeting Linux
56+
* `libiconv` (already included with glibc on Debian-based distros)
57+
58+
To build cargo, you'll also need OpenSSL (`libssl-dev` or `openssl-devel` on most Unix distros).
59+
60+
If building LLVM from source, you'll need additional tools:
61+
62+
* `g++`, `clang++`, or MSVC with versions listed on
63+
[LLVM's documentation](https://llvm.org/docs/GettingStarted.html#host-c-toolchain-both-compiler-and-standard-library)
64+
* `ninja`, or GNU `make` 3.81 or later (ninja is recommended, especially on Windows)
65+
* `cmake` 3.13.4 or later
66+
* `libstdc++-static` may be required on some Linux distributions such as Fedora and Ubuntu
6367

64-
2. Clone the [source] with `git`:
68+
On tier 1 or tier 2 with host tools platforms, you can also choose to download LLVM by setting `llvm.download-ci-llvm = true`.
69+
Otherwise, you'll need LLVM installed and `llvm-config` in your path.
70+
See [the rustc-dev-guide for more info][sysllvm].
71+
72+
[sysllvm]: https://rustc-dev-guide.rust-lang.org/building/new-target.html#using-pre-built-llvm
73+
74+
75+
### Building on a Unix-like system
76+
77+
1. Clone the [source] with `git`:
6578

6679
```sh
6780
git clone https://github.com/rust-lang/rust.git
@@ -70,38 +83,49 @@ by running it with the `--help` flag or reading the [rustc dev guide][rustcguide
7083

7184
[source]: https://github.com/rust-lang/rust
7285

73-
3. Configure the build settings:
86+
2. Configure the build settings:
7487

7588
The Rust build system uses a file named `config.toml` in the root of the
7689
source tree to determine various configuration settings for the build.
77-
Copy the default `config.toml.example` to `config.toml` to get started.
90+
Set up the defaults intended for distros to get started. You can see a full list of options
91+
in `config.toml.example`.
7892

7993
```sh
80-
cp config.toml.example config.toml
94+
printf 'profile = "user" \nchangelog-seen = 2 \n' > config.toml
8195
```
8296

8397
If you plan to use `x.py install` to create an installation, it is recommended
8498
that you set the `prefix` value in the `[install]` section to a directory.
8599

86-
Create an install directory if you are not installing in the default directory.
87-
88-
4. Build and install:
100+
3. Build and install:
89101

90102
```sh
91103
./x.py build && ./x.py install
92104
```
93105

94106
When complete, `./x.py install` will place several programs into
95107
`$PREFIX/bin`: `rustc`, the Rust compiler, and `rustdoc`, the
96-
API-documentation tool. This install does not include [Cargo],
97-
Rust's package manager. To build and install Cargo, you may
98-
run `./x.py install cargo` or set the `build.extended` key in
99-
`config.toml` to `true` to build and install all tools.
108+
API-documentation tool. If you've set `profile = "user"` or `build.extended = true`, it will
109+
also include [Cargo], Rust's package manager.
100110

101111
[Cargo]: https://github.com/rust-lang/cargo
102112

103113
### Building on Windows
104114

115+
On Windows, we suggest using [winget] to install dependencies by running the following in a terminal:
116+
117+
```powershell
118+
winget install -e Python.Python.3
119+
winget install -e Kitware.CMake
120+
winget install -e Git.Git
121+
```
122+
123+
Then edit your system's `PATH` variable and add: `C:\Program Files\CMake\bin`. See
124+
[this guide on editing the system `PATH`](https://www.java.com/en/download/help/path.html) from the
125+
Java documentation.
126+
127+
[winget]: https://github.com/microsoft/winget-cli
128+
105129
There are two prominent ABIs in use on Windows: the native (MSVC) ABI used by
106130
Visual Studio and the GNU ABI used by the GCC toolchain. Which version of Rust
107131
you need depends largely on what C/C++ libraries you want to interoperate with.
@@ -190,7 +214,7 @@ Windows build triples are:
190214
- `x86_64-pc-windows-msvc`
191215

192216
The build triple can be specified by either specifying `--build=<triple>` when
193-
invoking `x.py` commands, or by copying the `config.toml` file (as described
217+
invoking `x.py` commands, or by creating a `config.toml` file (as described
194218
in [Installing From Source](#installing-from-source)), and modifying the
195219
`build` option under the `[build]` section.
196220

@@ -204,9 +228,7 @@ configure script and makefile (the latter of which just invokes `x.py`).
204228
make && sudo make install
205229
```
206230

207-
When using the configure script, the generated `config.mk` file may override the
208-
`config.toml` file. To go back to the `config.toml` file, delete the generated
209-
`config.mk` file.
231+
`configure` generates a `config.toml` which can also be used with normal `x.py` invocations.
210232

211233
## Building Documentation
212234

@@ -227,41 +249,20 @@ precompiled "snapshot" version of itself (made in an earlier stage of
227249
development). As such, source builds require an Internet connection to
228250
fetch snapshots, and an OS that can execute the available snapshot binaries.
229251

230-
Snapshot binaries are currently built and tested on several platforms:
231-
232-
| Platform / Architecture | x86 | x86_64 |
233-
|---------------------------------------------|-----|--------|
234-
| Windows (7, 8, 10, ...) | ✓ | ✓ |
235-
| Linux (kernel 3.2, glibc 2.17 or later) | ✓ | ✓ |
236-
| macOS (10.7 Lion or later) | (\*) | ✓ |
237-
238-
(\*): Apple dropped support for running 32-bit binaries starting from macOS 10.15 and iOS 11.
239-
Due to this decision from Apple, the targets are no longer useful to our users.
240-
Please read [our blog post][macx32] for more info.
241-
242-
[macx32]: https://blog.rust-lang.org/2020/01/03/reducing-support-for-32-bit-apple-targets.html
252+
See https://doc.rust-lang.org/nightly/rustc/platform-support.html for a list of supported platforms.
253+
Only "host tools" platforms have a pre-compiled snapshot binary available; to compile for a platform
254+
without host tools you must cross-compile.
243255

244256
You may find that other platforms work, but these are our officially
245257
supported build environments that are most likely to work.
246258

247259
## Getting Help
248260

249-
The Rust community congregates in a few places:
250-
251-
* [Stack Overflow] - Direct questions about using the language.
252-
* [users.rust-lang.org] - General discussion and broader questions.
253-
* [/r/rust] - News and general discussion.
254-
255-
[Stack Overflow]: https://stackoverflow.com/questions/tagged/rust
256-
[/r/rust]: https://reddit.com/r/rust
257-
[users.rust-lang.org]: https://users.rust-lang.org/
261+
See https://www.rust-lang.org/community for a list of chat platforms and forums.
258262

259263
## Contributing
260264

261-
If you are interested in contributing to the Rust project, please take a look
262-
at the [Getting Started][gettingstarted] guide in the [rustc-dev-guide].
263-
264-
[rustc-dev-guide]: https://rustc-dev-guide.rust-lang.org
265+
See [CONTRIBUTING.md](CONTRIBUTING.md).
265266

266267
## License
267268

src/bootstrap/README.md

+2-8
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,12 @@ The script accepts commands, flags, and arguments to determine what to do:
8080

8181
## Configuring rustbuild
8282

83-
There are currently two methods for configuring the rustbuild build system.
84-
85-
First, rustbuild offers a TOML-based configuration system with a `config.toml`
83+
rustbuild offers a TOML-based configuration system with a `config.toml`
8684
file. An example of this configuration can be found at `config.toml.example`,
8785
and the configuration file can also be passed as `--config path/to/config.toml`
8886
if the build system is being invoked manually (via the python script).
8987

90-
Next, the `./configure` options serialized in `config.mk` will be
91-
parsed and read. That is, if any `./configure` options are passed, they'll be
92-
handled naturally. `./configure` should almost never be used for local
93-
installations, and is primarily useful for CI. Prefer to customize behavior
94-
using `config.toml`.
88+
You can generate a config.toml using `./configure` options if you want to automate creating the file without having to edit it.
9589

9690
Finally, rustbuild makes use of the [cc-rs crate] which has [its own
9791
method][env-vars] of configuring C compilers and C flags via environment

src/bootstrap/config.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,7 @@ pub enum DryRun {
4949

5050
/// Global configuration for the entire build and/or bootstrap.
5151
///
52-
/// This structure is derived from a combination of both `config.toml` and
53-
/// `config.mk`. As of the time of this writing it's unlikely that `config.toml`
54-
/// is used all that much, so this is primarily filled out by `config.mk` which
55-
/// is generated from `./configure`.
52+
/// This structure is parsed from `config.toml`, and some of the fields are inferred from `git` or build-time parameters.
5653
///
5754
/// Note that this structure is not decoded directly into, but rather it is
5855
/// filled out from the decoded forms of the structs below. For documentation

0 commit comments

Comments
 (0)