Skip to content

Commit 0533249

Browse files
committed
rustbuild: don't clobber RUSTFLAGS, append to it
1 parent a9dca3b commit 0533249

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/bootstrap/bootstrap.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,9 @@ def build_bootstrap(self):
643643
env["LIBRARY_PATH"] = os.path.join(self.bin_root(), "lib") + \
644644
(os.pathsep + env["LIBRARY_PATH"]) \
645645
if "LIBRARY_PATH" in env else ""
646-
env["RUSTFLAGS"] = "-Cdebuginfo=2 "
646+
# preserve existing RUSTFLAGS
647+
env.setdefault("RUSTFLAGS", "")
648+
env["RUSTFLAGS"] += " -Cdebuginfo=2"
647649

648650
build_section = "target.{}".format(self.build_triple())
649651
target_features = []
@@ -652,13 +654,13 @@ def build_bootstrap(self):
652654
elif self.get_toml("crt-static", build_section) == "false":
653655
target_features += ["-crt-static"]
654656
if target_features:
655-
env["RUSTFLAGS"] += "-C target-feature=" + (",".join(target_features)) + " "
657+
env["RUSTFLAGS"] += " -C target-feature=" + (",".join(target_features))
656658
target_linker = self.get_toml("linker", build_section)
657659
if target_linker is not None:
658-
env["RUSTFLAGS"] += "-C linker=" + target_linker + " "
659-
env["RUSTFLAGS"] += " -Wrust_2018_idioms -Wunused_lifetimes "
660+
env["RUSTFLAGS"] += " -C linker=" + target_linker
661+
env["RUSTFLAGS"] += " -Wrust_2018_idioms -Wunused_lifetimes"
660662
if self.get_toml("deny-warnings", "rust") != "false":
661-
env["RUSTFLAGS"] += "-Dwarnings "
663+
env["RUSTFLAGS"] += " -Dwarnings"
662664

663665
env["PATH"] = os.path.join(self.bin_root(), "bin") + \
664666
os.pathsep + env["PATH"]

0 commit comments

Comments
 (0)