Commit 20cb59b
committed
bootstrap: respect modern jobserver
When bootstrapping Rust, the `-j N` flag was passed to CMake, which was
then forwarded to Ninja. This prevents the jobserver from being used,
and as a result leads to oversubscription when Rust is just one of the
many packages built as part of a larger software stack.
Since Cargo and the Rust compiler have long supported the jobserver, it
would be good if also bootstrapping Rust itself would participate in the
protocol, leading to composable parallelism.
This change allows bootstrapping to respect an existing FIFO based
jobserver. Old pipe based jobservers are not supported, because they are
brittle: currently the Python scripts in bootstrap do not inherit the
file descriptors, but do pass on `MAKEFLAGS`. Because Ninja only
supports FIFO based jobservers, it's better to focus on new jobservers
only.
In summary:
* Bootstrap Cargo passes `MAKEFLAGS` verbatim to subprocesses if it
advertises a FIFO style jobserver, otherwise it unsets it.
* `llvm.rs` does not pass `-j` to `cmake` when a FIFO style jobserver is
set in `MAKEFLAGS.
* Bootstrap Cargo no longer unsets `MKFLAGS`: from git blame, GNU Make
considered it a historical artifact back in 1992, and it is never read
by GNU Make, it's only set for backwards compatibility.
Signed-off-by: Harmen Stoppels <me@harmenstoppels.nl>1 parent 79a1e77 commit 20cb59b
2 files changed
+20
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
773 | 773 | | |
774 | 774 | | |
775 | 775 | | |
776 | | - | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
777 | 785 | | |
778 | 786 | | |
779 | 787 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
547 | 547 | | |
548 | 548 | | |
549 | 549 | | |
550 | | - | |
551 | | - | |
552 | | - | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
553 | 561 | | |
554 | 562 | | |
555 | 563 | | |
| |||
0 commit comments