Files
metin2-client/scripts/port_gate.sh
T
shenandshen 846a993183 feat: complete xxf-ch5 35 features migration, protocol bindings, and gate validation
- S1: Chinese locale pack, target HP/drop preview, elemental icons, exchange level display, item highlight, FOV settings, advanced skybox, GM warp.
- S2: 5-page 225-slot inventory, seamless channel switch, wiki/drop query/chest preview.
- S3: Auto-refine/attribute locks, sash combine/absorb, talisman/elemental stats, costume/mount/shining slots, changelook, soulbind, glove, quiver, magic reduction.
- S4: Modern cube renewal, mythic dragon soul (6 grades/1152 slots), DS attr change, global rankings, dice system.
- S5: Multi-token shop, offline private shop search, offline shop state machine, 64-bit gold alignment, Won dual currency exchange.
- S6: Single account 5-character slot adaptive wire protocol, Wolfman profession & claw weapon/applies, Conqueror level & Sungma attributes, pets & 6th/7th attrs, battle pass & boss tracking.
- Pass 42/42 platform gate test suites in scripts/port_gate.sh macos.
2026-10-22 01:29:14 -07:00

92 lines
3.5 KiB
Bash
Executable File

#!/usr/bin/env bash
# Batch 2A gate (docs/PORT-PLAN.md): build port_logic, port_platform + the header self-containment gate per
# platform. A platform whose toolchain is missing prints BLOCKED and never counts as a pass.
#
# scripts/port_gate.sh [macos|android|ios|windows|linux ...] (default: all)
#
# Build trees go to $MT_PORT_GATE_DIR (default build/port-gate/). Toolchains:
# android ANDROID_NDK_HOME / ANDROID_NDK_ROOT (NDK 27.2)
# ios Xcode with the iphoneos SDK
# windows MT_WIN_CXX (default x86_64-w64-mingw32-g++); MSVC is covered on a Windows host
# linux MT_LINUX_TOOLCHAIN (a CMake toolchain file), or a Linux host
set -uo pipefail
cd "$(dirname "$0")/.."
OUT="${MT_PORT_GATE_DIR:-build/port-gate}"
PLATFORMS=("$@")
[ ${#PLATFORMS[@]} -eq 0 ] && PLATFORMS=(macos android ios windows linux)
PORT_ONLY=(-DMT_BUILD_NATIVE_RENDER=OFF)
declare -a RESULTS=()
run() { # name, build dir, configure args...
local name="$1" dir="$2"; shift 2
if cmake -S . -B "$dir" "$@" >"$dir.log" 2>&1 \
&& cmake --build "$dir" --target port_platform ${BUILD_EXTRA[@]+"${BUILD_EXTRA[@]}"} >>"$dir.log" 2>&1; then
RESULTS+=("$name PASS")
else
RESULTS+=("$name FAIL (see $dir.log)")
fi
}
mkdir -p "$OUT"
for p in "${PLATFORMS[@]}"; do
BUILD_EXTRA=()
case "$p" in
macos)
# Every port test target, so the ctest run below never meets a test the gate did not build.
BUILD_EXTRA=(--target all)
run macos "$OUT/macos" "${PORT_ONLY[@]}" -DBUILD_TESTING=ON
last=$((${#RESULTS[@]} - 1))
if [[ "${RESULTS[$last]}" == *PASS ]] && ! ctest --test-dir "$OUT/macos" -R '^port\.' --output-on-failure >>"$OUT/macos.log" 2>&1; then
RESULTS[$last]="macos FAIL (port tests, see $OUT/macos.log)"
fi
;;
android)
NDK="${ANDROID_NDK_ROOT:-${ANDROID_NDK_HOME:-}}"
SDK="${ANDROID_HOME:-${ANDROID_SDK_ROOT:-$HOME/Library/Android/sdk}}"
if [ -z "$NDK" ] && [ -d "$SDK/ndk" ]; then
NDK="$SDK/ndk/$(ls -1 "$SDK/ndk" | sort -V | tail -1)"
fi
if [ -z "$NDK" ] || [ ! -f "$NDK/build/cmake/android.toolchain.cmake" ]; then
RESULTS+=("android BLOCKED (no NDK)"); continue
fi
run android "$OUT/android" "${PORT_ONLY[@]}" -DBUILD_TESTING=OFF \
-DCMAKE_TOOLCHAIN_FILE="$NDK/build/cmake/android.toolchain.cmake" \
-DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=android-24
;;
ios)
if ! xcrun --sdk iphoneos --show-sdk-path >/dev/null 2>&1; then
RESULTS+=("ios BLOCKED (no iphoneos SDK)"); continue
fi
BUILD_EXTRA=(-- -sdk iphoneos CODE_SIGNING_ALLOWED=NO)
run ios "$OUT/ios" "${PORT_ONLY[@]}" -DBUILD_TESTING=OFF -G Xcode -DCMAKE_SYSTEM_NAME=iOS \
-DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0
;;
windows)
CXX_W="${MT_WIN_CXX:-x86_64-w64-mingw32-g++}"
if [[ "$(uname -s)" != MINGW* ]] && ! command -v "$CXX_W" >/dev/null; then
RESULTS+=("windows BLOCKED (no $CXX_W)"); continue
fi
run windows "$OUT/windows" "${PORT_ONLY[@]}" -DBUILD_TESTING=OFF -DCMAKE_SYSTEM_NAME=Windows \
-DCMAKE_C_COMPILER="${CXX_W%g++}gcc" -DCMAKE_CXX_COMPILER="$CXX_W"
;;
linux)
if [ "$(uname -s)" = Linux ]; then
BUILD_EXTRA=(--target port_common_test --target port_eterpack_test)
run linux "$OUT/linux" "${PORT_ONLY[@]}" -DBUILD_TESTING=ON
elif [ -n "${MT_LINUX_TOOLCHAIN:-}" ]; then
run linux "$OUT/linux" "${PORT_ONLY[@]}" -DBUILD_TESTING=OFF -DCMAKE_TOOLCHAIN_FILE="$MT_LINUX_TOOLCHAIN"
else
RESULTS+=("linux BLOCKED (not a Linux host and no MT_LINUX_TOOLCHAIN)")
fi
;;
*) RESULTS+=("$p UNKNOWN") ;;
esac
done
printf '%s\n' "${RESULTS[@]}"
for result in "${RESULTS[@]}"; do
[[ "$result" == *" PASS" ]] || exit 1
done
exit 0