-
Notifications
You must be signed in to change notification settings - Fork 28.3k
refactor(cargo): Clean up cargo build configs #75498
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: canary
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,34 +5,22 @@ TURBO_PNPM_WORKSPACE_DIR = { value = "", relative = true } | |
[alias] | ||
xtask = "run --package xtask --" | ||
|
||
[build] | ||
[target.'cfg(any(unix, not(unix)))'] | ||
# Cargo will merge rustflags from `target` sections together, but `target` | ||
# sections are mutually exclusive with `build` sections. Define this in an | ||
# always-matched `target` section, so that we don't have to duplicate flags | ||
# everywhere. | ||
# https://doc.rust-lang.org/cargo/reference/config.html#buildrustflags | ||
rustflags = [ | ||
"--cfg", | ||
"tokio_unstable", | ||
"--cfg=tokio_unstable", | ||
"-Zshare-generics=y", # make the current crate share its generic instantiations | ||
"-Zthreads=8", # parallel frontend https://blog.rust-lang.org/2023/11/09/parallel-rustc.html | ||
"-Csymbol-mangling-version=v0", | ||
] | ||
rustdocflags = [] | ||
|
||
[target.x86_64-pc-windows-msvc] | ||
linker = "rust-lld" | ||
rustflags = [ | ||
"--cfg", | ||
"tokio_unstable", | ||
"-Zshare-generics=y", | ||
"-C", | ||
"target-feature=+crt-static" | ||
] | ||
|
||
[target.i686-pc-windows-msvc] | ||
rustflags = [ | ||
"--cfg", | ||
"tokio_unstable", | ||
"-Zshare-generics=y", | ||
"-C", | ||
"target-feature=+crt-static" | ||
] | ||
Comment on lines
-28
to
-35
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We dropped support for 32-bit Windows a few months back because nobody is using it. |
||
rustflags = ["-Ctarget-feature=+crt-static"] | ||
|
||
[target.aarch64-pc-windows-msvc] | ||
linker = "rust-lld" | ||
|
@@ -42,38 +30,13 @@ linker = "rust-lld" | |
|
||
[target.'cfg(all(target_os = "linux", target_env = "gnu"))'] | ||
rustflags = [ | ||
"--cfg", | ||
"tokio_unstable", | ||
"-Zshare-generics=y", | ||
"-Zthreads=8", | ||
"-Zunstable-options", | ||
"-Csymbol-mangling-version=v0", | ||
"-Clinker-flavor=gnu-lld-cc", | ||
"-Clink-self-contained=+linker", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Apparently I added this line when I enabled |
||
] | ||
|
||
[target.aarch64-unknown-linux-musl] | ||
linker = "aarch64-linux-musl-gcc" | ||
# Config need to be mirrowed to .github/workflows/build_and_deploy.yml | ||
rustflags = [ | ||
"--cfg", | ||
"tokio_unstable", | ||
"-Zshare-generics=y", | ||
"-Csymbol-mangling-version=v0", | ||
"-Ctarget-feature=-crt-static", | ||
"-Clink-arg=-lgcc", | ||
] | ||
|
||
[target.x86_64-unknown-linux-musl] | ||
# Config need to be mirrowed to .github/workflows/build_and_deploy.yml | ||
rustflags = [ | ||
"--cfg", | ||
"tokio_unstable", | ||
"-Zshare-generics=y", | ||
"-Zthreads=8", | ||
"-Csymbol-mangling-version=v0", | ||
"-Ctarget-feature=-crt-static", | ||
] | ||
[target.'cfg(all(target_os = "linux", target_env = "musl"))'] | ||
# Rustflags for musl targets need to be mirrored to `.github/workflows/build_and_deploy.yml` | ||
# The napi cli sets a RUSTFLAGS environment variable that will otherwise override these options: | ||
# https://github.com/napi-rs/napi-rs/blob/2d8e19d7c626405287b73a52dc/cli/src/api/build.ts#L467-L485 | ||
rustflags = ["-Ctarget-feature=-crt-static"] | ||
|
||
[target.armv7-unknown-linux-gnueabihf] | ||
linker = "arm-linux-gnueabihf-gcc" | ||
Comment on lines
-78
to
-79
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to 32-bit Windows, I don't think anyone should be using this. Turbopack's only going to be useful on tiny projects if limited to 2 GB of RAM, plus arm is a niche platform to begin with. It doesn't look like we had CI for this anyways. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Overrides to `.cargo/config.toml` used by `pnpm build-native-release`/`pnpm | ||
# build-native-no-plugin-release` and the `build_and_deploy` GitHub actions | ||
# workflow. | ||
# | ||
# When using the napi CLI or the `pack-next` script, you can use | ||
# `--cargo-flags=--config=.cargo/release-config.toml` to enable this. | ||
# | ||
# cargo's merging logic combines rustflags in this file with those in the | ||
# relevant target sections of `.cargo/config.toml` | ||
|
||
[profile.release] | ||
strip = "symbols" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already the default? Probably just not cleaned up from prior changes.