summaryrefslogtreecommitdiffstats
path: root/src/bootstrap/configure.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/bootstrap/configure.py')
-rwxr-xr-xsrc/bootstrap/configure.py28
1 files changed, 23 insertions, 5 deletions
diff --git a/src/bootstrap/configure.py b/src/bootstrap/configure.py
index abd28b400..571062a3a 100755
--- a/src/bootstrap/configure.py
+++ b/src/bootstrap/configure.py
@@ -139,6 +139,10 @@ v("musl-root-mips64", "target.mips64-unknown-linux-muslabi64.musl-root",
"mips64-unknown-linux-muslabi64 install directory")
v("musl-root-mips64el", "target.mips64el-unknown-linux-muslabi64.musl-root",
"mips64el-unknown-linux-muslabi64 install directory")
+v("musl-root-riscv32gc", "target.riscv32gc-unknown-linux-musl.musl-root",
+ "riscv32gc-unknown-linux-musl install directory")
+v("musl-root-riscv64gc", "target.riscv64gc-unknown-linux-musl.musl-root",
+ "riscv64gc-unknown-linux-musl install directory")
v("qemu-armhf-rootfs", "target.arm-unknown-linux-gnueabihf.qemu-rootfs",
"rootfs in qemu testing, you probably don't want to use this")
v("qemu-aarch64-rootfs", "target.aarch64-unknown-linux-gnu.qemu-rootfs",
@@ -149,8 +153,7 @@ v("experimental-targets", "llvm.experimental-targets",
"experimental LLVM targets to build")
v("release-channel", "rust.channel", "the name of the release channel to build")
v("release-description", "rust.description", "optional descriptive string for version output")
-v("dist-compression-formats", None,
- "comma-separated list of compression formats to use")
+v("dist-compression-formats", None, "List of compression formats to use")
# Used on systems where "cc" is unavailable
v("default-linker", "rust.default-linker", "the default linker")
@@ -164,8 +167,8 @@ o("extended", "build.extended", "build an extended rust tool set")
v("tools", None, "List of extended tools will be installed")
v("codegen-backends", None, "List of codegen backends to build")
v("build", "build.build", "GNUs ./configure syntax LLVM build triple")
-v("host", None, "GNUs ./configure syntax LLVM host triples")
-v("target", None, "GNUs ./configure syntax LLVM target triples")
+v("host", None, "List of GNUs ./configure syntax LLVM host triples")
+v("target", None, "List of GNUs ./configure syntax LLVM target triples")
v("set", None, "set arbitrary key/value pairs in TOML configuration")
@@ -178,6 +181,11 @@ def err(msg):
print("configure: error: " + msg)
sys.exit(1)
+def is_value_list(key):
+ for option in options:
+ if option.name == key and option.desc.startswith('List of'):
+ return True
+ return False
if '--help' in sys.argv or '-h' in sys.argv:
print('Usage: ./configure [options]')
@@ -291,6 +299,8 @@ def set(key, value, config):
parts = key.split('.')
for i, part in enumerate(parts):
if i == len(parts) - 1:
+ if is_value_list(part) and isinstance(value, str):
+ value = value.split(',')
arr[part] = value
else:
if part not in arr:
@@ -417,6 +427,8 @@ def parse_example_config(known_args, config):
# Avoid using quotes unless it's necessary.
targets[target][0] = targets[target][0].replace("x86_64-unknown-linux-gnu", "'{}'".format(target) if "." in target else target)
+ if 'profile' not in config:
+ set('profile', 'user', config)
configure_file(sections, top_level_keys, targets, config)
return section_order, sections, targets
@@ -475,7 +487,7 @@ def configure_section(lines, config):
def configure_top_level_key(lines, top_level_key, value):
for i, line in enumerate(lines):
if line.startswith('#' + top_level_key + ' = ') or line.startswith(top_level_key + ' = '):
- lines[i] = "{} = {}".format(top_level_key, value)
+ lines[i] = "{} = {}".format(top_level_key, to_toml(value))
return
raise RuntimeError("failed to find config line for {}".format(top_level_key))
@@ -521,8 +533,14 @@ def write_config_toml(writer, section_order, targets, sections):
else:
writer = write_uncommented(sections[section], writer)
+def quit_if_file_exists(file):
+ if os.path.isfile(file):
+ err("Existing '" + file + "' detected.")
if __name__ == "__main__":
+ # If 'config.toml' already exists, exit the script at this point
+ quit_if_file_exists('config.toml')
+
p("processing command line")
# Parse all known arguments into a configuration structure that reflects the
# TOML we're going to write out