mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-27 02:48:34 +00:00
Try to build with musl on CI (#19571)
- Closes #19092 - Closes #15411 Release Notes: - SSH Remoting: Build with musl (adds support for machines with old, or no glibc)
This commit is contained in:
parent
33197608ed
commit
a9f48bd9d1
3 changed files with 8 additions and 5 deletions
1
.github/workflows/ci.yml
vendored
1
.github/workflows/ci.yml
vendored
|
@ -386,7 +386,6 @@ jobs:
|
||||||
|
|
||||||
- name: Upload app bundle to release
|
- name: Upload app bundle to release
|
||||||
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
|
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
|
||||||
if: ${{ env.RELEASE_CHANNEL == 'preview' || env.RELEASE_CHANNEL == 'stable' }}
|
|
||||||
with:
|
with:
|
||||||
draft: true
|
draft: true
|
||||||
prerelease: ${{ env.RELEASE_CHANNEL == 'preview' }}
|
prerelease: ${{ env.RELEASE_CHANNEL == 'preview' }}
|
||||||
|
|
|
@ -37,26 +37,28 @@ commit=$(git rev-parse HEAD | cut -c 1-7)
|
||||||
version_info=$(rustc --version --verbose)
|
version_info=$(rustc --version --verbose)
|
||||||
host_line=$(echo "$version_info" | grep host)
|
host_line=$(echo "$version_info" | grep host)
|
||||||
target_triple=${host_line#*: }
|
target_triple=${host_line#*: }
|
||||||
|
musl_triple=${target_triple%-gnu}-musl
|
||||||
|
|
||||||
# Generate the licenses first, so they can be baked into the binaries
|
# Generate the licenses first, so they can be baked into the binaries
|
||||||
script/generate-licenses
|
script/generate-licenses
|
||||||
|
rustup target add "$musl_triple"
|
||||||
|
|
||||||
# Build binary in release mode
|
# Build binary in release mode
|
||||||
export RUSTFLAGS="${RUSTFLAGS:-} -C link-args=-Wl,--disable-new-dtags,-rpath,\$ORIGIN/../lib"
|
export RUSTFLAGS="${RUSTFLAGS:-} -C link-args=-Wl,--disable-new-dtags,-rpath,\$ORIGIN/../lib"
|
||||||
cargo build --release --target "${target_triple}" --package zed --package cli
|
cargo build --release --target "${target_triple}" --package zed --package cli
|
||||||
# Build remote_server in separate invocation to prevent feature unification from other crates
|
# Build remote_server in separate invocation to prevent feature unification from other crates
|
||||||
# from influencing dynamic libraries required by it.
|
# from influencing dynamic libraries required by it.
|
||||||
cargo build --release --target "${target_triple}" --package remote_server
|
cargo build --release --target "${musl_triple}" --package remote_server
|
||||||
|
|
||||||
# Strip the binary of all debug symbols
|
# Strip the binary of all debug symbols
|
||||||
# Later, we probably want to do something like this: https://github.com/GabrielMajeri/separate-symbols
|
# Later, we probably want to do something like this: https://github.com/GabrielMajeri/separate-symbols
|
||||||
strip --strip-debug "${target_dir}/${target_triple}/release/zed"
|
strip --strip-debug "${target_dir}/${target_triple}/release/zed"
|
||||||
strip --strip-debug "${target_dir}/${target_triple}/release/cli"
|
strip --strip-debug "${target_dir}/${target_triple}/release/cli"
|
||||||
strip --strip-debug "${target_dir}/${target_triple}/release/remote_server"
|
strip --strip-debug "${target_dir}/${musl_triple}/release/remote_server"
|
||||||
|
|
||||||
|
|
||||||
# Ensure that remote_server does not depend on libssl nor libcrypto, as we got rid of these deps.
|
# Ensure that remote_server does not depend on libssl nor libcrypto, as we got rid of these deps.
|
||||||
! ldd "${target_dir}/${target_triple}/release/remote_server" | grep -q 'libcrypto\|libssl'
|
! ldd "${target_dir}/${musl_triple}/release/remote_server" | grep -q 'libcrypto\|libssl'
|
||||||
|
|
||||||
suffix=""
|
suffix=""
|
||||||
if [ "$channel" != "stable" ]; then
|
if [ "$channel" != "stable" ]; then
|
||||||
|
@ -125,4 +127,4 @@ remove_match="zed(-[a-zA-Z0-9]+)?-linux-$(uname -m)\.tar\.gz"
|
||||||
ls "${target_dir}/release" | grep -E ${remove_match} | xargs -d "\n" -I {} rm -f "${target_dir}/release/{}" || true
|
ls "${target_dir}/release" | grep -E ${remove_match} | xargs -d "\n" -I {} rm -f "${target_dir}/release/{}" || true
|
||||||
tar -czvf "${target_dir}/release/$archive" -C ${temp_dir} "zed$suffix.app"
|
tar -czvf "${target_dir}/release/$archive" -C ${temp_dir} "zed$suffix.app"
|
||||||
|
|
||||||
gzip --stdout --best "${target_dir}/${target_triple}/release/remote_server" > "${target_dir}/zed-remote-server-linux-${arch}.gz"
|
gzip --stdout --best "${target_dir}/${musl_triple}/release/remote_server" > "${target_dir}/zed-remote-server-linux-${arch}.gz"
|
||||||
|
|
|
@ -42,6 +42,8 @@ if [[ -n $apt ]]; then
|
||||||
gettext-base
|
gettext-base
|
||||||
elfutils
|
elfutils
|
||||||
libsqlite3-dev
|
libsqlite3-dev
|
||||||
|
musl-tools
|
||||||
|
musl-dev
|
||||||
)
|
)
|
||||||
if (grep -qP 'PRETTY_NAME="(Linux Mint 22|.+24\.04)' /etc/os-release); then
|
if (grep -qP 'PRETTY_NAME="(Linux Mint 22|.+24\.04)' /etc/os-release); then
|
||||||
deps+=( mold libstdc++-14-dev )
|
deps+=( mold libstdc++-14-dev )
|
||||||
|
|
Loading…
Reference in a new issue