32 lines · 1.1 KB · Text
RawDownload
#!/bin/bash set -e # Install cargo-bundle 0.5.0 if it's not already installedcargo install cargo-bundle --version 0.5.0 # Build the app bundle for x86_64pushd zed > /dev/nullcargo bundle --release --target x86_64-apple-darwinpopd > /dev/null # 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 binarieslipo -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 # 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.codesign --force --deep -s - target/x86_64-apple-darwin/release/bundle/osx/Zed.app # Create a DMGmkdir -p target/releasehdiutil 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 DMGwhile getopts o flagdo    case "${flag}" in        o) open target/release;;    esacdone