2021-04-29 00:02:02 +03:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2021-05-05 02:18:14 +03:00
|
|
|
# Build the app bundle for x86_64
|
2021-04-29 00:22:14 +03:00
|
|
|
pushd zed > /dev/null
|
2021-05-05 02:18:14 +03:00
|
|
|
cargo bundle --release --target x86_64-apple-darwin
|
2021-04-29 00:22:14 +03:00
|
|
|
popd > /dev/null
|
2021-04-29 00:02:02 +03:00
|
|
|
|
2021-05-05 02:18:14 +03:00
|
|
|
# Build the binary for aarch64 (Apple M1)
|
|
|
|
cargo build --release --target aarch64-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
|
|
|
|
|
|
|
|
# Create a 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
|
|
|
|
|
|
|
|
# If -o option is specified, open the target/release directory in Finder to reveal the DMG
|
2021-04-29 00:02:02 +03:00
|
|
|
while getopts o flag
|
|
|
|
do
|
|
|
|
case "${flag}" in
|
2021-05-05 02:18:14 +03:00
|
|
|
o) open target/release;;
|
2021-04-29 00:02:02 +03:00
|
|
|
esac
|
|
|
|
done
|