- 删除通用 desktop target,重命名 platform targets 为简短形式 (desktop-mac/win/linux)
- 构建产物文件名统一为 nex-{os}-{arch}[.exe] 格式
- Windows 托盘图标使用 .ico 格式(运行时按平台选择)
- Windows 原生对话框使用 user32.MessageBoxW 替代 msg * 命令
- 更新 README.md 和 package-macos.sh 中的引用
- 添加单元测试覆盖 MessageBoxW 封装和图标选择逻辑
- 同步更新 desktop-app spec 规范文档
69 lines
2.1 KiB
Bash
Executable File
69 lines
2.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
VERSION="1.0.0"
|
|
APP_NAME="Nex"
|
|
BUNDLE_ID="io.nex.gateway"
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
PROJECT_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)"
|
|
BUILD_DIR="${PROJECT_ROOT}/build"
|
|
ASSETS_DIR="${PROJECT_ROOT}/assets"
|
|
|
|
echo "打包 macOS .app..."
|
|
|
|
mkdir -p "${BUILD_DIR}/${APP_NAME}.app/Contents/MacOS"
|
|
mkdir -p "${BUILD_DIR}/${APP_NAME}.app/Contents/Resources"
|
|
|
|
if [ -f "${BUILD_DIR}/nex-mac-arm64" ]; then
|
|
cp "${BUILD_DIR}/nex-mac-arm64" "${BUILD_DIR}/${APP_NAME}.app/Contents/MacOS/nex"
|
|
elif [ -f "${BUILD_DIR}/nex-mac-amd64" ]; then
|
|
cp "${BUILD_DIR}/nex-mac-amd64" "${BUILD_DIR}/${APP_NAME}.app/Contents/MacOS/nex"
|
|
else
|
|
echo "错误: 未找到 macOS 二进制文件,请先运行 make desktop-mac"
|
|
exit 1
|
|
fi
|
|
|
|
if [ -f "${ASSETS_DIR}/AppIcon.icns" ]; then
|
|
cp "${ASSETS_DIR}/AppIcon.icns" "${BUILD_DIR}/${APP_NAME}.app/Contents/Resources/"
|
|
else
|
|
echo "警告: 未找到 AppIcon.icns"
|
|
fi
|
|
|
|
cat > "${BUILD_DIR}/${APP_NAME}.app/Contents/Info.plist" << EOF
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
<plist version="1.0">
|
|
<dict>
|
|
<key>CFBundleDevelopmentRegion</key>
|
|
<string>zh_CN</string>
|
|
<key>CFBundleExecutable</key>
|
|
<string>nex</string>
|
|
<key>CFBundleIconFile</key>
|
|
<string>AppIcon</string>
|
|
<key>CFBundleIdentifier</key>
|
|
<string>${BUNDLE_ID}</string>
|
|
<key>CFBundleInfoDictionaryVersion</key>
|
|
<string>6.0</string>
|
|
<key>CFBundleName</key>
|
|
<string>${APP_NAME} Gateway</string>
|
|
<key>CFBundleDisplayName</key>
|
|
<string>${APP_NAME} Gateway</string>
|
|
<key>CFBundlePackageType</key>
|
|
<string>APPL</string>
|
|
<key>CFBundleShortVersionString</key>
|
|
<string>${VERSION}</string>
|
|
<key>CFBundleVersion</key>
|
|
<string>${VERSION}</string>
|
|
<key>LSMinimumSystemVersion</key>
|
|
<string>10.13</string>
|
|
<key>LSUIElement</key>
|
|
<true/>
|
|
<key>NSHighResolutionCapable</key>
|
|
<true/>
|
|
</dict>
|
|
</plist>
|
|
EOF
|
|
|
|
chmod +x "${BUILD_DIR}/${APP_NAME}.app/Contents/MacOS/nex"
|
|
|
|
echo "打包完成: ${BUILD_DIR}/${APP_NAME}.app"
|