Skip to content

Commit

Permalink
Rollup merge of #111979 - jyn514:cargoflags, r=albertlarsan68
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
matthiaskrgr authored May 31, 2023
2 parents 3eaa3eb + 6674dcd commit 2e64710
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -918,6 +918,10 @@ def build_bootstrap(self, color, verbose_count):
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)
Expand Down

0 comments on commit 2e64710

Please sign in to comment.