build script update

This commit is contained in:
minjaesong
2023-08-27 21:01:13 +09:00
parent 3d5713cd31
commit 2bbf92d056
10 changed files with 91 additions and 41 deletions

View File

@@ -5,6 +5,8 @@ cd "${0%/*}"
SRCFILES="terrarumwindows_x86"
DESTDIR="TerrarumWindows.x86"
RUNTIME="runtime-windows-x86"
RCFILE="../out/build_autogen_windows.rc"
JARNAME="TerrarumBuild.jar"
if [ ! -d "../assets_release" ]; then
echo "'assets_release' does not exist; prepare the assets for the release and put them into the assets_release directory, exiting now." >&2
@@ -21,8 +23,11 @@ then
echo 'Mingw32 not found; please install mingw64-cross-gcc (or similar) to your system' >&2; exit 1;
fi
x86_64-w64-mingw32-gcc -Os -s -o $DESTDIR/Terrarum.exe $SRCFILES/Terrarum.c || { echo 'Building EXE failed' >&2; exit 1; }
# TODO add icon to the exe (use x86_64-w64-mingw32-windres?)
# Compile .rc
x86_64-w64-mingw32-windres $RCFILE -O coff -o $RCFILE.res
# compile exe
x86_64-w64-mingw32-gcc -Os -s -o $DESTDIR/Terrarum.exe $SRCFILES/Terrarum.c $RCFILE.res || { echo 'Building EXE failed' >&2; exit 1; }
# Copy over a Java runtime
mkdir $DESTDIR/out
@@ -32,10 +37,10 @@ mv $DESTDIR/out/$RUNTIME/bin/java.exe $DESTDIR/out/$RUNTIME/bin/Terrarum.exe
# Copy over all the assets and a jarfile
cp -r "../assets_release" $DESTDIR/
mv $DESTDIR/assets_release $DESTDIR/assets
cp "../out/TerrarumBuild.jar" $DESTDIR/out/
cp "../out/$JARNAME" $DESTDIR/out/
# Temporary solution: zip everything
rm "out/TerrarumWindows.x86.zip"
zip -r -9 -l "out/TerrarumWindows.x86.zip" $DESTDIR
# zip everything
rm "out/$DESTDIR.zip"
zip -r -9 -l "out/$DESTDIR.zip" $DESTDIR
rm -rf $DESTDIR || true
echo "Build successful: $DESTDIR"