red_dragon_pon/utils/build_release.sh
2025-07-14 17:13:10 +03:00

53 lines
1.2 KiB
Bash
Executable file

#!/bin/bash
GODOT_PATH="godot"
EXPORT_PATH="build"
EXPORT_NAME="rotdp.x86_64"
LOG_NAME="log.txt"
BUILD_PROFILE="release"
while getopts "g:p:n:l:d" opt; do
case $opt in
g)
GODOT_PATH="$OPTARG"
;;
p)
EXPORT_PATH="$OPTARG"
;;
n)
EXPORT_NAME="$OPTARG"
;;
l)
LOG_NAME="$OPTARG"
;;
d)
BUILD_PROFILE="debug"
;;
esac
done
# Checking if godot executable exist
builtin type -P "$GODOT_PATH" &> /dev/null
if [ $? -ne 0 ]; then
echo "\"$GODOT_PATH\" does not exist."
exit 1
fi
# godot exports builds with path relative to project.godot
if [ ! -e project.godot ]; then
echo "project.godot does not exist in current location. Please ensure that you are executing this script from project root folder."
exit 1
fi
if [ ! -d "$EXPORT_PATH" ]; then
mkdir $EXPORT_PATH
echo "Created directory $EXPORT_PATH."
fi
godot \
--headless \
--export-$BUILD_PROFILE Linux/x86_64 \
$EXPORT_PATH/$EXPORT_NAME \
> $EXPORT_PATH/$LOG_NAME
echo "Built game for Linux (x86_64) at $(pwd)/$EXPORT_PATH/$EXPORT_NAME.
Log located at $(pwd)/$EXPORT_PATH/$LOG_NAME."