branding/icon/icon.svg (a cracked Metin stone with glowing runes, inside a studded gold ring, in front of a blood moon over ink mountains) is the single source; build_icons.sh renders it with headless Chrome and writes the committed outputs: Android legacy + adaptive mipmaps (wired into the manifest), the macOS AppIcon.icns and the iOS AppIcon.appiconset. scripts/package_mac_app.sh wraps mt_native_render into a local Metin2.app using that icon. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
53 lines
2.4 KiB
Bash
Executable File
53 lines
2.4 KiB
Bash
Executable File
#!/bin/zsh
|
|
# Wraps a built mt_native_render into a double-clickable Metin2.app with the branding icon:
|
|
# scripts/package_mac_app.sh [BUILD_DIR=build/release] [CLIENT_DIR=<repo>/Client] [OUT=BUILD_DIR/Metin2.app]
|
|
# The bundle is for this machine: the executable still links Homebrew's SDL3 / Vulkan loader / MoltenVK, and
|
|
# the launcher runs the live client from CLIENT_DIR (an absolute path baked in; MT_CLIENT_DIR overrides it
|
|
# at launch). The shaders and python27.zip go to Contents/Resources, which SDL_GetBasePath returns in a bundle.
|
|
set -euo pipefail
|
|
repo=${0:A:h:h}
|
|
build=${1:-$repo/build/release}
|
|
client=${2:-$repo/Client}
|
|
out=${3:-$build/Metin2.app}
|
|
bin=$build/src/host/mt_native_render
|
|
[[ -x $bin ]] || { echo "missing $bin (build the mt_native_render target first)" >&2; exit 1; }
|
|
client=${client:A}
|
|
version=$(git -C $repo describe --always --dirty 2>/dev/null || echo dev)
|
|
|
|
rm -rf $out
|
|
mkdir -p $out/Contents/MacOS $out/Contents/Resources
|
|
cp $bin $out/Contents/MacOS/
|
|
cp $build/src/host/native.vert.spv $build/src/host/native.frag.spv $build/src/host/python27.zip $out/Contents/Resources/
|
|
cp $repo/branding/icon/macos/AppIcon.icns $out/Contents/Resources/
|
|
|
|
cat > $out/Contents/MacOS/Metin2 <<EOF
|
|
#!/bin/sh
|
|
# Finder starts apps with / as the working directory; the client reads its packs relative to its directory.
|
|
cd "\${MT_CLIENT_DIR:-$client}" || exit 1
|
|
exec "\$(dirname "\$0")/mt_native_render" --live-client . "\$@"
|
|
EOF
|
|
chmod +x $out/Contents/MacOS/Metin2
|
|
|
|
cat > $out/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>CFBundleName</key><string>Metin2</string>
|
|
<key>CFBundleDisplayName</key><string>Metin2</string>
|
|
<key>CFBundleIdentifier</key><string>org.metin2port.client</string>
|
|
<key>CFBundleExecutable</key><string>Metin2</string>
|
|
<key>CFBundleIconFile</key><string>AppIcon</string>
|
|
<key>CFBundlePackageType</key><string>APPL</string>
|
|
<key>CFBundleShortVersionString</key><string>0.1</string>
|
|
<key>CFBundleVersion</key><string>$version</string>
|
|
<key>LSMinimumSystemVersion</key><string>12.0</string>
|
|
<key>LSApplicationCategoryType</key><string>public.app-category.role-playing-games</string>
|
|
<key>NSHighResolutionCapable</key><true/>
|
|
</dict>
|
|
</plist>
|
|
EOF
|
|
# Ad-hoc signature so Gatekeeper on Apple silicon runs the copied binary.
|
|
codesign --force --deep --sign - $out >/dev/null 2>&1 || true
|
|
echo $out
|