diff --git a/script/bundle b/script/bundle index bcaa68c1e9c04c9d6aaa7379a5b2de5e82920a93..fc6bab355f4cdf2a4a61b8d9e92638d76f2af952 100755 --- a/script/bundle +++ b/script/bundle @@ -4,24 +4,33 @@ set -e 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 # Deal with versions of macOS that don't include libstdc++ headers export CXXFLAGS="-stdlib=libc++" -# Build the app bundle for x86_64 -pushd crates/zed > /dev/null -cargo bundle --release --target x86_64-apple-darwin -popd > /dev/null +echo "Compiling binaries" +cargo build --release --package zed --target aarch64-apple-darwin +cargo build --release --package zed --target x86_64-apple-darwin +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) -cargo build --release --target aarch64-apple-darwin +echo "Creating application bundle" +(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 -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 +echo "Creating fat binaries" +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 echo "Signing bundle with Apple-issued certificate" 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 fi -# Create a DMG echo "Creating DMG" mkdir -p target/release hdiutil create -volname Zed -srcfolder target/x86_64-apple-darwin/release/bundle/osx -ov -format UDZO target/release/Zed.dmg