[turbopack] Improve regressed build speed on cross-compiled MUSL (#91477)
# What
Refactor build_and_deploy.yml to make it more maintainable, add
documentation to all of the quirky flags we use and remove any flags
that are not doing anything useful.
# Non-goals
- wasm builds were left out of the matrix, but could probably be added
in at a later date
- cross-compilation flags should probably not live in .cargo/config.toml
but rather in a .cargo/cross-config.toml we conditionally include, but
this would add some complexity.
# Why
After enabling LTO, our MUSL target builds got significantly slower.
This wins back a good chunk of the performance that we lost by using
cross-compilation to MUSL on docker images that are not slow as heck,
while also trying to clean up this workflow that has accumulated some
cruft over the years.
The timings are fairly unstable because of uncertain build machine
variability, but I've tried to capture uncached runs where possible. I
believe we can state that LTO has a _slight_ increase in compile time,
but MUSL builds are faster than the pre-LTO state of things.
# Changes
- Refactor build_and_deploy.yml: replace per-target matrix entries with
mmm-matrix declarative config, consolidate docker build script inline,
pin actions to commit SHAs
- Simplify .cargo/config.toml using cfg(true) (RFC 3695) to eliminate
rustflag duplication across target sections
- Remove GNU linker flags (rust-lld is now default on x86_64-linux-gnu)
- Use rust-lld directly for musl targets, remove unused armv7 section
- Add cargo xtask print-rustflags to replace .github/rustflags.yml
- Release profile: thin LTO + codegen-units=64 for faster builds
- Add --log-order stream to TURBO_ARGS for live build output
- Remove mold linker integration from CI