Update bundle script to include fat CLI binary
This commit is contained in:
parent
a81f7ebbf6
commit
184a454f6f
1 changed files with 19 additions and 11 deletions
|
@ -4,24 +4,33 @@ set -e
|
||||||
|
|
||||||
export ZED_BUNDLE=true
|
export ZED_BUNDLE=true
|
||||||
|
|
||||||
# Install cargo-bundle 0.5.0 if it's not already installed
|
echo "Installing cargo bundle"
|
||||||
cargo install cargo-bundle --version 0.5.0
|
cargo install cargo-bundle --version 0.5.0
|
||||||
|
|
||||||
# Deal with versions of macOS that don't include libstdc++ headers
|
# Deal with versions of macOS that don't include libstdc++ headers
|
||||||
export CXXFLAGS="-stdlib=libc++"
|
export CXXFLAGS="-stdlib=libc++"
|
||||||
|
|
||||||
# Build the app bundle for x86_64
|
echo "Compiling binaries"
|
||||||
pushd crates/zed > /dev/null
|
cargo build --release --package zed --target aarch64-apple-darwin
|
||||||
cargo bundle --release --target x86_64-apple-darwin
|
cargo build --release --package zed --target x86_64-apple-darwin
|
||||||
popd > /dev/null
|
cargo build --release --package cli --target aarch64-apple-darwin
|
||||||
|
cargo build --release --package cli --target x86_64-apple-darwin
|
||||||
|
|
||||||
# Build the binary for aarch64 (Apple M1)
|
echo "Creating application bundle"
|
||||||
cargo build --release --target aarch64-apple-darwin
|
(cd crates/zed && cargo bundle --release --target x86_64-apple-darwin)
|
||||||
|
|
||||||
# Replace the bundle's binary with a "fat binary" that combines the two architecture-specific binaries
|
echo "Creating fat binaries"
|
||||||
lipo -create target/x86_64-apple-darwin/release/Zed target/aarch64-apple-darwin/release/Zed -output target/x86_64-apple-darwin/release/bundle/osx/Zed.app/Contents/MacOS/zed
|
lipo \
|
||||||
|
-create \
|
||||||
|
target/{x86_64-apple-darwin,aarch64-apple-darwin}/release/Zed \
|
||||||
|
-output \
|
||||||
|
target/x86_64-apple-darwin/release/bundle/osx/Zed.app/Contents/MacOS/zed
|
||||||
|
lipo \
|
||||||
|
-create \
|
||||||
|
target/{x86_64-apple-darwin,aarch64-apple-darwin}/release/cli \
|
||||||
|
-output \
|
||||||
|
target/x86_64-apple-darwin/release/bundle/osx/Zed.app/Contents/MacOS/cli
|
||||||
|
|
||||||
# Sign the app bundle with an ad-hoc signature so it runs on the M1. We need a real certificate but this works for now.
|
|
||||||
if [[ -n $MACOS_CERTIFICATE && -n $MACOS_CERTIFICATE_PASSWORD && -n $APPLE_NOTARIZATION_USERNAME && -n $APPLE_NOTARIZATION_PASSWORD ]]; then
|
if [[ -n $MACOS_CERTIFICATE && -n $MACOS_CERTIFICATE_PASSWORD && -n $APPLE_NOTARIZATION_USERNAME && -n $APPLE_NOTARIZATION_PASSWORD ]]; then
|
||||||
echo "Signing bundle with Apple-issued certificate"
|
echo "Signing bundle with Apple-issued certificate"
|
||||||
security create-keychain -p $MACOS_CERTIFICATE_PASSWORD zed.keychain || echo ""
|
security create-keychain -p $MACOS_CERTIFICATE_PASSWORD zed.keychain || echo ""
|
||||||
|
@ -39,7 +48,6 @@ else
|
||||||
codesign --force --deep --sign - target/x86_64-apple-darwin/release/bundle/osx/Zed.app -v
|
codesign --force --deep --sign - target/x86_64-apple-darwin/release/bundle/osx/Zed.app -v
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create a DMG
|
|
||||||
echo "Creating DMG"
|
echo "Creating DMG"
|
||||||
mkdir -p target/release
|
mkdir -p target/release
|
||||||
hdiutil create -volname Zed -srcfolder target/x86_64-apple-darwin/release/bundle/osx -ov -format UDZO target/release/Zed.dmg
|
hdiutil create -volname Zed -srcfolder target/x86_64-apple-darwin/release/bundle/osx -ov -format UDZO target/release/Zed.dmg
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue