You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
96 lines
2.5 KiB
96 lines
2.5 KiB
5 days ago
|
#!/bin/bash
|
||
|
|
||
|
set -e
|
||
|
|
||
|
# 项目信息
|
||
|
APP_NAME="Wormhole Client"
|
||
|
VERSION="v1.0.0"
|
||
|
|
||
|
# 路径配置
|
||
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||
|
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||
|
|
||
|
echo "🚀 Building Wormhole Client DMG Installer"
|
||
|
echo "=========================================="
|
||
|
echo "📦 Version: $VERSION"
|
||
|
echo "📁 Project: $PROJECT_ROOT"
|
||
|
echo ""
|
||
|
|
||
|
# 检查必要的工具
|
||
|
echo "🔍 Checking required tools..."
|
||
|
|
||
|
# 检查 Go
|
||
|
if ! command -v go &> /dev/null; then
|
||
|
echo "❌ Go is not installed. Please install Go first."
|
||
|
exit 1
|
||
|
fi
|
||
|
echo "✅ Go: $(go version)"
|
||
|
|
||
|
# 检查 hdiutil (macOS 内置)
|
||
|
if ! command -v hdiutil &> /dev/null; then
|
||
|
echo "❌ hdiutil not found. This script requires macOS."
|
||
|
exit 1
|
||
|
fi
|
||
|
echo "✅ hdiutil: Available"
|
||
|
|
||
|
# 检查 osascript (macOS 内置)
|
||
|
if ! command -v osascript &> /dev/null; then
|
||
|
echo "❌ osascript not found. This script requires macOS."
|
||
|
exit 1
|
||
|
fi
|
||
|
echo "✅ osascript: Available"
|
||
|
|
||
|
echo ""
|
||
|
|
||
|
# 步骤 1: 构建应用程序包
|
||
|
echo "📱 Step 1: Building macOS application bundle..."
|
||
|
echo "----------------------------------------------"
|
||
|
if [ -f "$SCRIPT_DIR/build-macos.sh" ]; then
|
||
|
chmod +x "$SCRIPT_DIR/build-macos.sh"
|
||
|
"$SCRIPT_DIR/build-macos.sh"
|
||
|
else
|
||
|
echo "❌ build-macos.sh not found!"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
echo ""
|
||
|
|
||
|
# 步骤 2: 创建 DMG
|
||
|
echo "💿 Step 2: Creating DMG installer..."
|
||
|
echo "------------------------------------"
|
||
|
if [ -f "$SCRIPT_DIR/create-dmg.sh" ]; then
|
||
|
chmod +x "$SCRIPT_DIR/create-dmg.sh"
|
||
|
"$SCRIPT_DIR/create-dmg.sh"
|
||
|
else
|
||
|
echo "❌ create-dmg.sh not found!"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
echo ""
|
||
|
|
||
|
# 完成总结
|
||
|
echo "🎉 BUILD COMPLETED SUCCESSFULLY!"
|
||
|
echo "================================="
|
||
|
BUILD_DIR="$PROJECT_ROOT/build"
|
||
|
FINAL_DMG="$BUILD_DIR/Wormhole-Client-$VERSION.dmg"
|
||
|
|
||
|
if [ -f "$FINAL_DMG" ]; then
|
||
|
echo "📦 DMG File: $FINAL_DMG"
|
||
|
echo "📊 File Size: $(du -h "$FINAL_DMG" | cut -f1)"
|
||
|
echo "🔗 SHA256: $(shasum -a 256 "$FINAL_DMG" | cut -d' ' -f1)"
|
||
|
echo ""
|
||
|
echo "📋 Distribution Ready:"
|
||
|
echo "1. Test the DMG by double-clicking it"
|
||
|
echo "2. Verify the application installs and runs correctly"
|
||
|
echo "3. Share the DMG file for distribution"
|
||
|
echo ""
|
||
|
echo "🔒 Security Notes:"
|
||
|
echo "- Users may need to allow the app in System Preferences > Security & Privacy"
|
||
|
echo "- Consider code signing for easier distribution"
|
||
|
echo "- For distribution outside the App Store, users may need to right-click and 'Open'"
|
||
|
echo ""
|
||
|
echo "✨ Your macOS installer is ready!"
|
||
|
else
|
||
|
echo "❌ DMG creation failed!"
|
||
|
exit 1
|
||
|
fi
|