Update linux binary expectations (#12622)

Fixes #12585

This changes the expectations for installed binaries on linux based on
work
that @jirutka has done for Alpine.

In particular, we now put the cli in place as `bin/zed` and the zed
binary as
`libexec/zed-editor`, and assume that packagers do the same.

cc @someone13574

Release notes:

- N/A

---------

Co-authored-by: Mikayla <mikayla@zed.dev>
This commit is contained in:
Conrad Irwin 2024-06-04 16:31:01 -06:00 committed by GitHub
parent c7d56302d2
commit 27beb9e697
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 65 additions and 35 deletions

View file

@ -43,7 +43,7 @@ cargo build --release --target "${target_triple}" --package zed --package cli
# Strip the binary of all debug symbols
# Later, we probably want to do something like this: https://github.com/GabrielMajeri/separate-symbols
strip "target/${target_triple}/release/Zed"
strip "target/${target_triple}/release/zed"
strip "target/${target_triple}/release/cli"
suffix=""
@ -57,13 +57,13 @@ temp_dir=$(mktemp -d)
zed_dir="${temp_dir}/zed$suffix.app"
# Binary
mkdir -p "${zed_dir}/bin"
cp "target/${target_triple}/release/Zed" "${zed_dir}/bin/zed"
cp "target/${target_triple}/release/cli" "${zed_dir}/bin/cli"
mkdir -p "${zed_dir}/bin" "${zed_dir}/libexec"
cp "target/${target_triple}/release/zed" "${zed_dir}/libexec/zed-editor"
cp "target/${target_triple}/release/cli" "${zed_dir}/bin/zed"
# Libs
find_libs() {
ldd target/${target_triple}/release/Zed |\
ldd target/${target_triple}/release/zed |\
cut -d' ' -f3 |\
grep -v '\<\(libstdc++.so\|libc.so\|libgcc_s.so\|libm.so\|libpthread.so\|libdl.so\)'
}

View file

@ -10,8 +10,6 @@ local_arch=false
local_only=false
local_install=false
bundle_name=""
zed_crate="zed"
binary_name="Zed"
# This must match the team in the provisioning profile.
APPLE_NOTORIZATION_TEAM="MQ55VZLNZQ"
@ -80,10 +78,10 @@ local_target_triple=${host_line#*: }
if [ "$local_arch" = true ]; then
echo "Building for local target only."
cargo build ${build_flag} --package ${zed_crate} --package cli
cargo build ${build_flag} --package zed --package cli
else
echo "Compiling zed binaries"
cargo build ${build_flag} --package ${zed_crate} --package cli --target aarch64-apple-darwin --target x86_64-apple-darwin
cargo build ${build_flag} --package zed --package cli --target aarch64-apple-darwin --target x86_64-apple-darwin
fi
echo "Creating application bundle"
@ -91,7 +89,7 @@ pushd crates/zed
channel=$(<RELEASE_CHANNEL)
popd
pushd crates/${zed_crate}
pushd crates/zed
cp Cargo.toml Cargo.toml.backup
sed \
-i .backup \
@ -186,7 +184,7 @@ function prepare_binaries() {
target/${architecture}/${target_dir}/Zed.dwarf.gz \
"$channel/Zed-$version-${architecture}.dwarf.gz"
cp target/${architecture}/${target_dir}/${binary_name} "${app_path}/Contents/MacOS/${zed_crate}"
cp target/${architecture}/${target_dir}/zed "${app_path}/Contents/MacOS/zed"
cp target/${architecture}/${target_dir}/cli "${app_path}/Contents/MacOS/cli"
}
@ -207,7 +205,7 @@ function sign_binaries() {
download_git "${architecture}" "${app_path}/Contents/MacOS/git"
# Note: The app identifier for our development builds is the same as the app identifier for nightly.
cp crates/${zed_crate}/contents/$channel/embedded.provisionprofile "${app_path}/Contents/"
cp crates/zed/contents/$channel/embedded.provisionprofile "${app_path}/Contents/"
if [[ -n "${MACOS_CERTIFICATE:-}" && -n "${MACOS_CERTIFICATE_PASSWORD:-}" && -n "${APPLE_NOTARIZATION_USERNAME:-}" && -n "${APPLE_NOTARIZATION_PASSWORD:-}" ]]; then
echo "Signing bundle with Apple-issued certificate"
@ -223,8 +221,8 @@ function sign_binaries() {
/usr/bin/codesign --deep --force --timestamp --sign "Zed Industries, Inc." "${app_path}/Contents/Frameworks/WebRTC.framework" -v
/usr/bin/codesign --deep --force --timestamp --options runtime --sign "Zed Industries, Inc." "${app_path}/Contents/MacOS/cli" -v
/usr/bin/codesign --deep --force --timestamp --options runtime --sign "Zed Industries, Inc." "${app_path}/Contents/MacOS/git" -v
/usr/bin/codesign --deep --force --timestamp --options runtime --entitlements crates/${zed_crate}/resources/zed.entitlements --sign "Zed Industries, Inc." "${app_path}/Contents/MacOS/${zed_crate}" -v
/usr/bin/codesign --force --timestamp --options runtime --entitlements crates/${zed_crate}/resources/zed.entitlements --sign "Zed Industries, Inc." "${app_path}" -v
/usr/bin/codesign --deep --force --timestamp --options runtime --entitlements crates/zed/resources/zed.entitlements --sign "Zed Industries, Inc." "${app_path}/Contents/MacOS/zed" -v
/usr/bin/codesign --force --timestamp --options runtime --entitlements crates/zed/resources/zed.entitlements --sign "Zed Industries, Inc." "${app_path}" -v
security default-keychain -s login.keychain
else
@ -243,7 +241,7 @@ function sign_binaries() {
# - get a signing key for the MQ55VZLNZQ team from Nathan.
# - create your own signing key, and update references to MQ55VZLNZQ to your own team ID
# then comment out this line.
cat crates/${zed_crate}/resources/zed.entitlements | sed '/com.apple.developer.associated-domains/,+1d' > "${app_path}/Contents/Resources/zed.entitlements"
cat crates/zed/resources/zed.entitlements | sed '/com.apple.developer.associated-domains/,+1d' > "${app_path}/Contents/Resources/zed.entitlements"
codesign --force --deep --entitlements "${app_path}/Contents/Resources/zed.entitlements" --sign ${MACOS_SIGNING_KEY:- -} "${app_path}" -v
fi
@ -364,9 +362,9 @@ else
app_path=target/release/$(basename "$app_path_x64")
lipo \
-create \
target/{x86_64-apple-darwin,aarch64-apple-darwin}/${target_dir}/${binary_name} \
target/{x86_64-apple-darwin,aarch64-apple-darwin}/${target_dir}/zed \
-output \
"${app_path}/Contents/MacOS/${zed_crate}"
"${app_path}/Contents/MacOS/zed"
lipo \
-create \
target/{x86_64-apple-darwin,aarch64-apple-darwin}/${target_dir}/cli \

View file

@ -80,7 +80,12 @@ linux() {
mkdir -p "$HOME/.local/bin" "$HOME/.local/share/applications"
# Link the binary
ln -sf ~/.local/zed$suffix.app/bin/cli "$HOME/.local/bin/zed"
if [ -f ~/.local/zed$suffix.app/bin/zed ]; then
ln -sf ~/.local/zed$suffix.app/bin/zed "$HOME/.local/bin/zed"
else
# support for versions before 0.139.x.
ln -sf ~/.local/zed$suffix.app/bin/cli "$HOME/.local/bin/zed"
fi
# Copy .desktop file
desktop_file_path="$HOME/.local/share/applications/${appid}.desktop"

View file

@ -121,10 +121,10 @@ if (user) {
}
let buildArgs = ["build"];
let zedBinary = "target/debug/Zed";
let zedBinary = "target/debug/zed";
if (isReleaseMode) {
buildArgs.push("--release");
zedBinary = "target/release/Zed";
zedBinary = "target/release/zed";
}
try {