Share generics better and strip rodio audio features (#64260)

* Preserve bundle compiler flags commit commit is a follow-up to
https://github.com/zed-industries/zed/pull/63432

Linux bundling script had custom `RUSTFLAGS` set which eradicated prior
config.
Moved all flags into `.cargo/bundle-config.toml` instead.

* Trim audio features and compress resources commit removes unused
`rodio` features and enables resource compression

The win from the latter seems not that large, so can revert if needed,
but seemed very easy to enable.

With compiler wrappers disabled, `cargo clean --target-dir
target/binary-size-split-build` and `cargo build --locked -p zed`:
Before: 135.6s wall, 1569.8s CPU, zed binary 1175563800 bytes
After: 130.5s wall (-3.8%), 1488.7s CPU (-5.2%), zed binary 1171527064
bytes (-0.3%, -4.0MB)

With `ZED_BUNDLE=true CXXFLAGS=-stdlib=libc++` and `cargo --config
.cargo/bundle-config.toml build --locked --release -p zed -p cli
--target aarch64-apple-darwin`:
Before: 369.4s wall, 3861.6s CPU, zed binary 381662328 bytes
After: 369.4s wall (+0.01%), 3866.1s CPU (+0.1%), zed binary 377836968
bytes (-1.0%, -3.8MB)

Release Notes:

- N/A
This commit is contained in:
Kirill Bulatov authored and GitHub committed 2026-09-16 16:03:18 +00:00
1 parent 8b9a2df705
commit e0590874fd
9 files changed
+154 -111

No files matched your search

+5 -10
View File
@@ -43,6 +43,11 @@ while [[ $# -gt 0 ]]; do
esac
done
if [[ -n "${RUSTFLAGS+x}" || -n "${CARGO_ENCODED_RUSTFLAGS+x}" ]]; then
echo "Unset RUSTFLAGS and CARGO_ENCODED_RUSTFLAGS; put extra flags in target rustflags in .cargo/config.toml so bundle flags are preserved." >&2
exit 1
fi
export ZED_BUNDLE=true
channel=$(<crates/zed/RELEASE_CHANNEL)
@@ -74,20 +79,10 @@ fi
export CC=${CC:-$(which clang)}
# Build binary in release mode
# We need lld to link libwebrtc.a successfully on aarch64-linux.
# NOTE: Since RUSTFLAGS env var overrides all .cargo/config.toml rustflags
# (see https://github.com/rust-lang/cargo/issues/5376), the
# [target.aarch64-unknown-linux-gnu] section in config.toml has no effect here.
if [[ "$(uname -m)" == "aarch64" ]]; then
export RUSTFLAGS="${RUSTFLAGS:-} -C link-arg=-fuse-ld=lld -C link-args=-Wl,--disable-new-dtags,-rpath,\$ORIGIN/../lib"
else
export RUSTFLAGS="${RUSTFLAGS:-} -C link-args=-Wl,--disable-new-dtags,-rpath,\$ORIGIN/../lib"
fi
cargo --config .cargo/bundle-config.toml build --release --target "${target_triple}" --package zed --package cli
# Build remote_server in separate invocation to prevent feature unification from other crates
# from influencing dynamic libraries required by it.
if [[ "$remote_server_triple" == "$musl_triple" ]]; then
export RUSTFLAGS="${RUSTFLAGS:-} -C target-feature=+crt-static"
musl_cc_var="CC_$(echo "$remote_server_triple" | tr '-' '_')"
export "$musl_cc_var"=musl-gcc
fi