about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-05-31 11:19:08 +0200
committerGitHub <noreply@github.com>2023-05-31 11:19:08 +0200
commitaee05c74e190c8d435cb6269256e448fc7e0a684 (patch)
tree24e88a1687614790fbb1dd6d0bfb9caf6d8a86db
parentef82bd4b5508f7b55ecae7f1b12613018fbf51ae (diff)
parent6674dcda7a1da4c66e0aa0cfc67b27e42f4ebb34 (diff)
downloadrust-aee05c74e190c8d435cb6269256e448fc7e0a684.tar.gz
rust-aee05c74e190c8d435cb6269256e448fc7e0a684.zip
Rollup merge of #111979 - jyn514:cargoflags, r=albertlarsan68
Respect CARGOFLAGS in bootstrap.py

This makes it possible to pass flags to bootstrap itself, for consistency with std/rustc: https://github.com/rust-lang/rust/blob/04265621f9a82cfc2fc2278b935dcc5d4a1c39b7/src/bootstrap/builder.rs#L1446-L1447
Like RUSTFLAGS, this doesn't support CARGOFLAGS_BOOTSTRAP: https://github.com/rust-lang/rust/blob/6674dcda7a1da4c66e0aa0cfc67b27e42f4ebb34/src/bootstrap/bootstrap.py#L883-L884

I found this useful recently when I wanted to pass `-Zsparse-registry` to an old checkout of the compiler from before it was stabilized in cargo.
-rw-r--r--src/bootstrap/bootstrap.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
index de484f3a571..75df5345169 100644
--- a/src/bootstrap/bootstrap.py
+++ b/src/bootstrap/bootstrap.py
@@ -918,6 +918,10 @@ class RustBuild(object):
             args.append("--color=always")
         elif color == "never":
             args.append("--color=never")
+        try:
+            args += env["CARGOFLAGS"].split()
+        except KeyError:
+            pass
 
         # Run this from the source directory so cargo finds .cargo/config
         run(args, env=env, verbose=self.verbose, cwd=self.rust_root)