#!/bin/sh # Make AnyBot.app from the release build and zip it (run from app/ on a Mac, after # `cargo build --release`): deploy/mac/bundle.sh 1.2.0 → dist/AnyBot-1.2.0-macos-.zip # With KEEP_APP=1 it leaves dist/AnyBot.app instead of zipping it (make install). # Signed ad hoc (no Apple developer account): the first time, right-click › 打開. set -e VERSION=${1:?version} BIN=${CARGO_TARGET_DIR:-target}/release/anybot ARCH=$(uname -m) OUT=dist APP="$OUT/AnyBot.app" rm -rf "$APP" && mkdir -p "$APP/Contents/MacOS" "$APP/Contents/Resources" cp "$BIN" "$APP/Contents/MacOS/AnyBot" # The icon: every size the system asks for. SET=$(mktemp -d)/AnyBot.iconset mkdir -p "$SET" for s in 16 32 128 256 512; do "$BIN" --write-icon "$SET/icon_${s}x${s}.png" $s "$BIN" --write-icon "$SET/icon_${s}x${s}@2x.png" $((s * 2)) done iconutil -c icns "$SET" -o "$APP/Contents/Resources/AnyBot.icns" cat > "$APP/Contents/Info.plist" < CFBundleNameAnyBot CFBundleDisplayNameAnyBot CFBundleIdentifiernet.30cm.anybot CFBundleExecutableAnyBot CFBundleIconFileAnyBot CFBundlePackageTypeAPPL CFBundleShortVersionString$VERSION CFBundleVersion$VERSION LSMinimumSystemVersion12.0 NSHighResolutionCapable NSMicrophoneUsageDescription語音聊天時,聽你說話。 NSAppleEventsUsageDescription讓 Bot 在你允許時操作其他 App。 PLIST codesign --force --deep -s - "$APP" if [ "${KEEP_APP:-}" = 1 ]; then exit 0 fi ditto -c -k --norsrc --keepParent "$APP" "$OUT/AnyBot-$VERSION-macos-$ARCH.zip" rm -rf "$APP" ls -la "$OUT"