Skip to content

Commit a9b0a7b

Browse files
committedAug 28, 2017
rustbuild: Rewrite the configure script in Python
This commit rewrites our ancient `./configure` script from shell into Python. The impetus for this change is to remove `config.mk` which is just a vestige of the old makefile build system at this point. Instead all configuration is now solely done through `config.toml`. The python script allows us to more flexibly program (aka we can use loops easily) and create a `config.toml` which is based off `config.toml.example`. This way we can preserve comments and munge various values as we see fit. It is intended that the configure script here is a drop-in replacement for the previous configure script, no functional change is intended. Also note that the rationale for this is also because our build system requires Python, so having a python script a bit earlier shouldn't cause too many problems. Closes rust-lang#40730
·
1 parent 398aaff commit a9b0a7b

File tree

8 files changed

+653
-1217
lines changed

8 files changed

+653
-1217
lines changed
 

‎config.toml.example

+31
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@
7373
# controlled by rustbuild's -j parameter.
7474
#link-jobs = 0
7575

76+
# When invoking `llvm-config` this configures whether the `--shared` argument is
77+
# passed to prefer linking to shared libraries.
78+
#link-shared = false
79+
7680
# =============================================================================
7781
# General build configuration options
7882
# =============================================================================
@@ -166,6 +170,15 @@
166170
# to +10 on Unix platforms, and by using a "low priority" job object on Windows.
167171
#low-priority = false
168172

173+
# Arguments passed to the `./configure` script, used during distcheck. You
174+
# probably won't fill this in but rather it's filled in by the `./configure`
175+
# script.
176+
#configure-args = []
177+
178+
# Indicates that a local rebuild is ocurring instead of a full bootstrap,
179+
# essentially skipping stage0 as the local compiler is recompiling itself again.
180+
#local-rebuild = false
181+
169182
# =============================================================================
170183
# General install configuration options
171184
# =============================================================================
@@ -195,6 +208,13 @@
195208
# =============================================================================
196209
[rust]
197210

211+
# Indicates that the build should be optimized for debugging Rust. Note that
212+
# this is typically not what you want as it takes an incredibly large amount of
213+
# time to have a debug-mode rustc compile any code (notably libstd). If this
214+
# value is set to `true` it will affect a number of configuration options below
215+
# as well, if unconfigured.
216+
#debug = false
217+
198218
# Whether or not to optimize the compiler and standard library
199219
# Note: the slowness of the non optimized compiler compiling itself usually
200220
# outweighs the time gains in not doing optimizations, therefore a
@@ -249,6 +269,10 @@
249269
# desired in distributions, for example.
250270
#rpath = true
251271

272+
# Suppresses extraneous output from tests to ensure the output of the test
273+
# harness is relatively clean.
274+
#quiet-tests = false
275+
252276
# Flag indicating whether tests are compiled with optimizations (the -O flag) or
253277
# with debuginfo (the -g flag)
254278
#optimize-tests = true
@@ -261,6 +285,9 @@
261285
# Flag indicating whether git info will be retrieved from .git automatically.
262286
#ignore-git = false
263287

288+
# When creating source tarballs whether or not to create a source tarball.
289+
#dist-src = false
290+
264291
# =============================================================================
265292
# Options for specific targets
266293
#
@@ -304,6 +331,10 @@
304331
# linked binaries
305332
#musl-root = "..."
306333

334+
# Used in testing for configuring where the QEMU images are located, you
335+
# probably don't want to use this.
336+
#qemu-rootfs = "..."
337+
307338
# =============================================================================
308339
# Distribution options
309340
#

‎configure

+10-772
Large diffs are not rendered by default.

‎src/bootstrap/README.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,9 @@ The script accepts commands, flags, and arguments to determine what to do:
7676
There are currently two methods for configuring the rustbuild build system.
7777

7878
First, rustbuild offers a TOML-based configuration system with a `config.toml`
79-
file in the same location as `config.mk`. An example of this configuration can
80-
be found at `config.toml.example`, and the configuration file can also be passed
81-
as `--config path/to/config.toml` if the build system is being invoked manually
82-
(via the python script).
79+
file. An example of this configuration can be found at `config.toml.example`,
80+
and the configuration file can also be passed as `--config path/to/config.toml`
81+
if the build system is being invoked manually (via the python script).
8382

8483
Next, the `./configure` options serialized in `config.mk` will be
8584
parsed and read. That is, if any `./configure` options are passed, they'll be

‎src/bootstrap/bootstrap.py

+149-187
Large diffs are not rendered by default.

‎src/bootstrap/config.rs

+51-252
Large diffs are not rendered by default.

‎src/bootstrap/configure.py

+408
Large diffs are not rendered by default.

‎src/bootstrap/dist.rs

+1
Original file line numberDiff line numberDiff line change
@@ -822,6 +822,7 @@ impl Step for PlainSourceTarball {
822822
"RELEASES.md",
823823
"configure",
824824
"x.py",
825+
"config.toml.example",
825826
];
826827
let src_dirs = [
827828
"man",

‎src/bootstrap/mk/Makefile.in

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
# option. This file may not be copied, modified, or distributed
99
# except according to those terms.
1010

11-
include config.mk
12-
1311
ifdef VERBOSE
1412
Q :=
1513
BOOTSTRAP_ARGS := -v

0 commit comments

Comments
 (0)
Please sign in to comment.