]> git.lizzy.rs Git - rust.git/commitdiff
Respect --set=target.platform during build
authorMarcus Calhoun-Lopez <marcuscalhounlopez@gmail.com>
Mon, 26 Dec 2022 03:52:14 +0000 (20:52 -0700)
committerMarcus Calhoun-Lopez <marcuscalhounlopez@gmail.com>
Thu, 29 Dec 2022 19:22:49 +0000 (12:22 -0700)
Avoid quoting targets that do not contain a period.
See https://github.com/rust-lang/rust/commit/1532fd8cd0db93f469e414f9da31ef083a44fcba

`--set=target.platform.linker` is ignored if RUSTFLAGS is not set.
Undo parts of https://github.com/rust-lang/rust/commit/d1291dc8b4ac9a98ff1d286402559e4ba5d68488

src/bootstrap/bootstrap.py
src/bootstrap/configure.py

index 2d5018d934e2e27023b8ea25122517ce0c3a16f4..9cf43fc7a2193f1b67c5cd51e2927e98dff7b941 100644 (file)
@@ -753,6 +753,9 @@ class RustBuild(object):
             target_features += ["-crt-static"]
         if target_features:
             env["RUSTFLAGS"] += " -C target-feature=" + (",".join(target_features))
+        target_linker = self.get_toml("linker", build_section)
+        if target_linker is not None:
+            env["RUSTFLAGS"] += " -C linker=" + target_linker
         env["RUSTFLAGS"] += " -Wrust_2018_idioms -Wunused_lifetimes"
         env["RUSTFLAGS"] += " -Wsemicolon_in_expressions_from_macros"
         if self.get_toml("deny-warnings", "rust") != "false":
index 6b139decb555193f3990962a6812a217867c281c..31cc4aa57bbea45170f4ff339e424528c1edee5c 100755 (executable)
@@ -405,7 +405,9 @@ if 'target' in config:
         configured_targets.append(target)
 for target in configured_targets:
     targets[target] = sections['target'][:]
-    targets[target][0] = targets[target][0].replace("x86_64-unknown-linux-gnu", "'{}'".format(target))
+    # For `.` to be valid TOML, it needs to be quoted. But `bootstrap.py` doesn't use a proper TOML parser and fails to parse the target.
+    # 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)
 
 
 def is_number(value):