Files
Emberwild/tools/export.sh

44 lines
1.8 KiB
Bash
Executable File

#!/bin/sh
# Builds the packaged game (export_presets.cfg) into build/:
#
# tools/export.sh # macOS and Windows
# tools/export.sh macOS # just one ("macOS" or "Windows")
#
# build/Emberwild-<version>-macos.zip the .app (universal: Apple silicon + Intel),
# ad-hoc signed, not notarised
# build/Emberwild-<version>-windows.zip Emberwild.exe + Emberwild.pck (+ a console
# wrapper), unsigned
#
# Needs the Godot export templates for this Godot's version (Editor > Manage
# Export Templates, or the .tpz from the Godot release page).
cd "$(dirname "$0")/.." || exit 1
. tools/godot_env.sh
VERSION=$(sed -n 's/^application\/short_version="\(.*\)"/\1/p' export_presets.cfg | head -1)
which=${1:-all}
mkdir -p build
"$GODOT" --headless --path . --import >/dev/null 2>&1
if [ "$which" = all ] || [ "$which" = macOS ]; then
rm -rf build/macos && mkdir -p build/macos
"$GODOT" --headless --path . --export-release "macOS" build/macos/Emberwild.zip > build/export-macos.log 2>&1
if [ -f build/macos/Emberwild.zip ]; then
mv build/macos/Emberwild.zip "build/Emberwild-$VERSION-macos.zip"
echo "built build/Emberwild-$VERSION-macos.zip"
else
echo "macOS export failed: see build/export-macos.log"; exit 1
fi
fi
if [ "$which" = all ] || [ "$which" = Windows ]; then
rm -rf build/windows && mkdir -p build/windows/Emberwild
"$GODOT" --headless --path . --export-release "Windows" build/windows/Emberwild/Emberwild.exe > build/export-windows.log 2>&1
if [ -f build/windows/Emberwild/Emberwild.exe ]; then
(cd build/windows && rm -f "../Emberwild-$VERSION-windows.zip" && zip -qr "../Emberwild-$VERSION-windows.zip" Emberwild)
echo "built build/Emberwild-$VERSION-windows.zip"
else
echo "Windows export failed: see build/export-windows.log"; exit 1
fi
fi