package-darwin.sh (view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
#!/usr/bin/env bash
set -euo pipefail
APP_NAME="EMessage"
OUTPUT_DIR="./build/bin/${APP_NAME}"
APP_BUNDLE="./build/bin/${APP_NAME}.app"
# Ensure output directory exists
mkdir -p "$OUTPUT_DIR"
# 1. Copy the universal executable to specific architecture names
UNIVERSAL_EXE="${OUTPUT_DIR}/darwin-universal"
if [[ ! -f "$UNIVERSAL_EXE" ]]; then
echo "Error: Universal executable not found at ${UNIVERSAL_EXE}"
exit 1
fi
cp "$UNIVERSAL_EXE" "${OUTPUT_DIR}/darwin-amd64"
cp "$UNIVERSAL_EXE" "${OUTPUT_DIR}/darwin-arm64"
echo "Created darwin-amd64 and darwin-arm64 from universal executable"
# 2. Tar the .app bundle into the output directory as 'darwin-app'
if [[ ! -d "$APP_BUNDLE" ]]; then
echo "Error: .app bundle not found at ${APP_BUNDLE}"
exit 1
fi
TARFILE="${OUTPUT_DIR}/darwin-app"
tar cf "$TARFILE" -C "$(dirname "$APP_BUNDLE")" "$(basename "$APP_BUNDLE")"
echo "Created ${TARFILE}"
|