Build self-contained macOS client and verify native beta path
This commit is contained in:
+23
-6
@@ -3,18 +3,23 @@
|
||||
#
|
||||
# ./build-macos-client.sh [debug|release]
|
||||
#
|
||||
# 产物:build/export/mtgodot-poc.app(资源和 BGM 自包含在 Contents/Resources/)。
|
||||
# 产物:build/export/mtgodot-poc.app(40250 Client/pack 和 BGM 自包含)。
|
||||
# 依赖:Godot 4.7.1 的 macOS 导出模板(editor 里 “管理导出模板” 装,或放
|
||||
# ~/Library/Application Support/Godot/export_templates/4.7.1.stable/macos.zip)。
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")"
|
||||
REPO="$(pwd)"
|
||||
SOURCE_CLIENT="${MT_40250_CLIENT:-$REPO/../40250/Server Client TMP4/Client}"
|
||||
CFG="${1:-debug}"
|
||||
OUT="${MT_MAC_OUTPUT_DIR:-$REPO/build/export}"
|
||||
APP="$OUT/mtgodot-poc.app"
|
||||
GODOT="${GODOT:-godot}"
|
||||
MAC_ARCHES="${MT_MAC_ARCHES:-universal}"
|
||||
ENGINE_OVERRIDE="${MT_MAC_ENGINE:-}"
|
||||
test -f "$SOURCE_CLIENT/pack/Index" || {
|
||||
echo "错误:缺少 40250 Client/pack/Index:$SOURCE_CLIENT" >&2
|
||||
exit 1
|
||||
}
|
||||
if [ -n "$ENGINE_OVERRIDE" ]; then
|
||||
test -x "$ENGINE_OVERRIDE"
|
||||
ENGINE_INFO="$(lipo -info "$ENGINE_OVERRIDE")"
|
||||
@@ -59,11 +64,23 @@ else
|
||||
"$GODOT" --headless --path project --export-debug macOS "$APP"
|
||||
fi
|
||||
|
||||
echo "== 3. 资源(自包含)=="
|
||||
mkdir -p "$APP/Contents/Resources"
|
||||
ditto "$REPO/assets" "$APP/Contents/Resources/assets"
|
||||
ditto "$REPO/bgm" "$APP/Contents/Resources/bgm"
|
||||
test -f "$APP/Contents/Resources/assets/asset_index.txt"
|
||||
echo "== 3. 40250 资源(自包含)=="
|
||||
BUNDLE_CLIENT="$APP/Contents/Resources/40250/Client"
|
||||
mkdir -p "$BUNDLE_CLIENT"
|
||||
ditto "$SOURCE_CLIENT/pack" "$BUNDLE_CLIENT/pack"
|
||||
if [ -d "$SOURCE_CLIENT/BGM" ]; then ditto "$SOURCE_CLIENT/BGM" "$BUNDLE_CLIENT/BGM"; fi
|
||||
if [ -f "$SOURCE_CLIENT/locale.cfg" ]; then cp "$SOURCE_CLIENT/locale.cfg" "$BUNDLE_CLIENT/locale.cfg"; fi
|
||||
test -s "$BUNDLE_CLIENT/pack/Index"
|
||||
|
||||
# Record the exact source revision inside the signed bundle. A Beta release is built only
|
||||
# after its changes are committed, so the identity remains useful when the checkout moves on.
|
||||
python3 - "$REPO" "$APP/Contents/Resources/beta-build.json" <<'PY'
|
||||
import json, pathlib, subprocess, sys
|
||||
repo, output = sys.argv[1:]
|
||||
commit = subprocess.check_output(['git', '-C', repo, 'rev-parse', 'HEAD'], text=True).strip()
|
||||
dirty = bool(subprocess.check_output(['git', '-C', repo, 'status', '--porcelain', '--untracked-files=normal'], text=True).strip())
|
||||
pathlib.Path(output).write_text(json.dumps({'source_commit': commit, 'source_dirty': dirty}, indent=2) + '\n')
|
||||
PY
|
||||
|
||||
echo "== 4. 签名(默认 ad-hoc;CODESIGN_IDENTITY 可切正式证书)=="
|
||||
if [ -n "$ENGINE_OVERRIDE" ]; then
|
||||
|
||||
Reference in New Issue
Block a user