Skip to content

Commit 81ef1f9

Browse files
authored
Rollup merge of rust-lang#40056 - keeperofdakeys:contributing, r=alexcrichton
Replace ./configure with config.toml in README.md and CONTRIBUTING.md Replace ./configure with config.toml in README.md and CONTRIBUTING.md, so that new users aren't confused about which build system to use, and how to configure the build process.
2 parents f190779 + 2c695d7 commit 81ef1f9

File tree

2 files changed

+71
-42
lines changed

2 files changed

+71
-42
lines changed

Diff for: CONTRIBUTING.md

+31-23
Original file line numberDiff line numberDiff line change
@@ -97,33 +97,38 @@ system internals, try asking in [`#rust-internals`][pound-rust-internals].
9797

9898
Before you can start building the compiler you need to configure the build for
9999
your system. In most cases, that will just mean using the defaults provided
100-
for Rust. Configuring involves invoking the `configure` script in the project
101-
root.
100+
for Rust.
102101

103-
```
104-
./configure
105-
```
102+
To change configuration, you must copy the file `src/bootstrap/config.toml.example`
103+
to `config.toml` in the directory from which you will be running the build, and
104+
change the settings provided.
105+
106+
There are large number of options provided in this config file that will alter the
107+
configuration used in the build process. Some options to note:
106108

107-
There are large number of options accepted by this script to alter the
108-
configuration used later in the build process. Some options to note:
109+
#### `[llvm]`:
110+
- `ccache = true` - Use ccache when building llvm
109111

110-
- `--enable-debug` - Build a debug version of the compiler (disables optimizations,
111-
which speeds up compilation of stage1 rustc)
112-
- `--enable-optimize` - Enable optimizations (can be used with `--enable-debug`
113-
to make a debug build with optimizations)
114-
- `--disable-valgrind-rpass` - Don't run tests with valgrind
115-
- `--enable-clang` - Prefer clang to gcc for building dependencies (e.g., LLVM)
116-
- `--enable-ccache` - Invoke clang/gcc with ccache to re-use object files between builds
117-
- `--enable-compiler-docs` - Build compiler documentation
112+
#### `[build]`:
113+
- `compiler-docs = true` - Build compiler documentation
118114

119-
To see a full list of options, run `./configure --help`.
115+
#### `[rust]`:
116+
- `debuginfo = true` - Build a compiler with debuginfo
117+
- `optimize = false` - Disable optimizations to speed up compilation of stage1 rust
118+
119+
For more options, the `config.toml` file contains commented out defaults, with
120+
descriptions of what each option will do.
121+
122+
Note: Previously the `./configure` script was used to configure this
123+
project. It can still be used, but it's recommended to use a `config.toml`
124+
file. If you still have a `config.mk` file in your directory - from
125+
`./configure` - you may need to delete it for `config.toml` to work.
120126

121127
### Building
122128

123-
Although the `./configure` script will generate a `Makefile`, this is actually
124-
just a thin veneer over the actual build system driver, `x.py`. This file, at
125-
the root of the repository, is used to build, test, and document various parts
126-
of the compiler. You can execute it as:
129+
The build system uses the `x.py` script to control the build process. This script
130+
is used to build, test, and document various parts of the compiler. You can
131+
execute it as:
127132

128133
```sh
129134
python x.py build
@@ -185,6 +190,9 @@ To learn about all possible rules you can execute, run:
185190
python x.py build --help --verbose
186191
```
187192

193+
Note: Previously `./configure` and `make` were used to build this project.
194+
They are still available, but `x.py` is the recommended build system.
195+
188196
### Useful commands
189197

190198
Some common invocations of `x.py` are:
@@ -235,8 +243,8 @@ feature. We use the 'fork and pull' model described there.
235243

236244
Please make pull requests against the `master` branch.
237245

238-
Compiling all of `make check` can take a while. When testing your pull request,
239-
consider using one of the more specialized `make` targets to cut down on the
246+
Compiling all of `./x.py test` can take a while. When testing your pull request,
247+
consider using one of the more specialized `./x.py` targets to cut down on the
240248
amount of time you have to wait. You need to have built the compiler at least
241249
once before running these will work, but that’s only one full build rather than
242250
one each time.
@@ -307,7 +315,7 @@ To find documentation-related issues, sort by the [A-docs label][adocs].
307315

308316
[adocs]: https://github.com/rust-lang/rust/issues?q=is%3Aopen+is%3Aissue+label%3AA-docs
309317

310-
In many cases, you don't need a full `make doc`. You can use `rustdoc` directly
318+
In many cases, you don't need a full `./x.py doc`. You can use `rustdoc` directly
311319
to check small fixes. For example, `rustdoc src/doc/reference.md` will render
312320
reference to `doc/reference.html`. The CSS might be messed up, but you can
313321
verify that the HTML is right.

Diff for: README.md

+40-19
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ Read ["Installing Rust"] from [The Book].
3535
3. Build and install:
3636

3737
```sh
38-
$ ./configure
39-
$ make && sudo make install
38+
$ ./x.py build && sudo ./x.py dist --install
4039
```
4140

42-
> ***Note:*** Install locations can be adjusted by passing a `--prefix`
43-
> argument to `configure`. Various other options are also supported – pass
44-
> `--help` for more information on them.
41+
> ***Note:*** Install locations can be adjusted by copying the config file
42+
> from `./src/bootstrap/config.toml.example` to `./config.toml`, and
43+
> adjusting the `prefix` option under `[install]`. Various other options are
44+
> also supported, and are documented in the config file.
4545

46-
When complete, `sudo make install` will place several programs into
46+
When complete, `sudo ./x.py dist --install` will place several programs into
4747
`/usr/local/bin`: `rustc`, the Rust compiler, and `rustdoc`, the
4848
API-documentation tool. This install does not include [Cargo],
4949
Rust's package manager, which you may also want to build.
@@ -59,7 +59,6 @@ for interop with software produced by Visual Studio use the MSVC build of Rust;
5959
for interop with GNU software built using the MinGW/MSYS2 toolchain use the GNU
6060
build.
6161
62-
6362
#### MinGW
6463
6564
[MSYS2][msys2] can be used to easily build Rust on Windows:
@@ -94,11 +93,10 @@ build.
9493
mingw-w64-x86_64-gcc
9594
```
9695

97-
4. Navigate to Rust's source code (or clone it), then configure and build it:
96+
4. Navigate to Rust's source code (or clone it), then build it:
9897

9998
```sh
100-
$ ./configure
101-
$ make && make install
99+
$ ./x.py build && ./x.py dist --install
102100
```
103101

104102
#### MSVC
@@ -114,13 +112,6 @@ shell with:
114112
> python x.py build
115113
```
116114

117-
If you're running inside of an msys shell, however, you can run:
118-
119-
```sh
120-
$ ./configure --build=x86_64-pc-windows-msvc
121-
$ make && make install
122-
```
123-
124115
Currently building Rust only works with some known versions of Visual Studio. If
125116
you have a more recent version installed the build system doesn't understand
126117
then you may need to force rustbuild to use an older version. This can be done
@@ -131,13 +122,43 @@ CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.
131122
python x.py build
132123
```
133124

125+
#### Specifying an ABI
126+
127+
Each specific ABI can also be used from either environment (for example, using
128+
the GNU ABI in powershell) by using an explicit build triple. The available
129+
Windows build triples are:
130+
- GNU ABI (using GCC)
131+
- `i686-pc-windows-gnu`
132+
- `x86_64-pc-windows-gnu`
133+
- The MSVC ABI
134+
- `i686-pc-windows-msvc`
135+
- `x86_64-pc-windows-msvc`
136+
137+
The build triple can be specified by either specifying `--build=ABI` when
138+
invoking `x.py` commands, or by copying the `config.toml` file (as described
139+
in Building From Source), and modifying the `build` option under the `[build]`
140+
section.
141+
142+
### Configure and Make
143+
144+
While it's not the recommended build system, this project also provides a
145+
configure script and makefile (the latter of which just invokes `x.py`).
146+
147+
```sh
148+
$ ./configure
149+
$ make && sudo make install
150+
```
151+
152+
When using the configure script, the generated config.mk` file may override the
153+
`config.toml` file. To go back to the `config.toml` file, delete the generated
154+
`config.mk` file.
155+
134156
## Building Documentation
135157

136158
If you’d like to build the documentation, it’s almost the same:
137159

138160
```sh
139-
$ ./configure
140-
$ make docs
161+
$ ./x.py doc
141162
```
142163

143164
The generated documentation will appear in a top-level `doc` directory,

0 commit comments

Comments
 (0)