mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
build script update
This commit is contained in:
@@ -6,6 +6,8 @@ APPIMAGETOOL="appimagetool-x86_64.AppImage"
|
|||||||
SRCFILES="terrarumlinux_arm"
|
SRCFILES="terrarumlinux_arm"
|
||||||
DESTDIR="TerrarumLinux.arm"
|
DESTDIR="TerrarumLinux.arm"
|
||||||
RUNTIME="runtime-linux-arm"
|
RUNTIME="runtime-linux-arm"
|
||||||
|
DESKTOPFILE="../out/build_autogen_linux.desktop"
|
||||||
|
JARNAME="TerrarumBuild.jar"
|
||||||
|
|
||||||
if [ ! -d "../assets_release" ]; then
|
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
|
echo "'assets_release' does not exist; prepare the assets for the release and put them into the assets_release directory, exiting now." >&2
|
||||||
@@ -18,7 +20,7 @@ mkdir $DESTDIR
|
|||||||
|
|
||||||
# Prepare an application
|
# Prepare an application
|
||||||
cp icns.png $DESTDIR/icns.png
|
cp icns.png $DESTDIR/icns.png
|
||||||
cp $SRCFILES/Terrarum.desktop $DESTDIR/
|
cp $DESKTOPFILE $DESTDIR/
|
||||||
cp $SRCFILES/AppRun $DESTDIR/AppRun
|
cp $SRCFILES/AppRun $DESTDIR/AppRun
|
||||||
chmod +x $DESTDIR/AppRun
|
chmod +x $DESTDIR/AppRun
|
||||||
|
|
||||||
@@ -30,7 +32,7 @@ mv $DESTDIR/out/$RUNTIME/bin/java $DESTDIR/out/$RUNTIME/bin/Terrarum
|
|||||||
# Copy over all the assets and a jarfile
|
# Copy over all the assets and a jarfile
|
||||||
cp -r "../assets_release" $DESTDIR/
|
cp -r "../assets_release" $DESTDIR/
|
||||||
mv $DESTDIR/assets_release $DESTDIR/assets
|
mv $DESTDIR/assets_release $DESTDIR/assets
|
||||||
cp "../out/TerrarumBuild.jar" $DESTDIR/out/
|
cp "../out/$JARNAME" $DESTDIR/out/
|
||||||
|
|
||||||
# Pack everything to AppImage
|
# Pack everything to AppImage
|
||||||
ARCH=arm_aarch64 "./$APPIMAGETOOL" $DESTDIR "out/$DESTDIR.AppImage" || { echo 'Building AppImage failed' >&2; exit 1; }
|
ARCH=arm_aarch64 "./$APPIMAGETOOL" $DESTDIR "out/$DESTDIR.AppImage" || { echo 'Building AppImage failed' >&2; exit 1; }
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ APPIMAGETOOL="appimagetool-x86_64.AppImage"
|
|||||||
SRCFILES="terrarumlinux_x86"
|
SRCFILES="terrarumlinux_x86"
|
||||||
DESTDIR="TerrarumLinux.x86"
|
DESTDIR="TerrarumLinux.x86"
|
||||||
RUNTIME="runtime-linux-x86"
|
RUNTIME="runtime-linux-x86"
|
||||||
|
DESKTOPFILE="../out/build_autogen_linux.desktop"
|
||||||
|
JARNAME="TerrarumBuild.jar"
|
||||||
|
|
||||||
if [ ! -d "../assets_release" ]; then
|
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
|
echo "'assets_release' does not exist; prepare the assets for the release and put them into the assets_release directory, exiting now." >&2
|
||||||
@@ -18,7 +20,7 @@ mkdir $DESTDIR
|
|||||||
|
|
||||||
# Prepare an application
|
# Prepare an application
|
||||||
cp icns.png $DESTDIR/icns.png
|
cp icns.png $DESTDIR/icns.png
|
||||||
cp $SRCFILES/Terrarum.desktop $DESTDIR/
|
cp $DESKTOPFILE $DESTDIR/
|
||||||
cp $SRCFILES/AppRun $DESTDIR/AppRun
|
cp $SRCFILES/AppRun $DESTDIR/AppRun
|
||||||
chmod +x $DESTDIR/AppRun
|
chmod +x $DESTDIR/AppRun
|
||||||
|
|
||||||
@@ -30,7 +32,7 @@ mv $DESTDIR/out/$RUNTIME/bin/java $DESTDIR/out/$RUNTIME/bin/Terrarum
|
|||||||
# Copy over all the assets and a jarfile
|
# Copy over all the assets and a jarfile
|
||||||
cp -r "../assets_release" $DESTDIR/
|
cp -r "../assets_release" $DESTDIR/
|
||||||
mv $DESTDIR/assets_release $DESTDIR/assets
|
mv $DESTDIR/assets_release $DESTDIR/assets
|
||||||
cp "../out/TerrarumBuild.jar" $DESTDIR/out/
|
cp "../out/$JARNAME" $DESTDIR/out/
|
||||||
|
|
||||||
# Pack everything to AppImage
|
# Pack everything to AppImage
|
||||||
"./$APPIMAGETOOL" $DESTDIR "out/$DESTDIR.AppImage" || { echo 'Building AppImage failed' >&2; exit 1; }
|
"./$APPIMAGETOOL" $DESTDIR "out/$DESTDIR.AppImage" || { echo 'Building AppImage failed' >&2; exit 1; }
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ SRCFILES="terrarummac_arm"
|
|||||||
APPDIR="./TerrarumMac.arm.app"
|
APPDIR="./TerrarumMac.arm.app"
|
||||||
DESTDIR="out/$APPDIR"
|
DESTDIR="out/$APPDIR"
|
||||||
RUNTIME="runtime-osx-arm"
|
RUNTIME="runtime-osx-arm"
|
||||||
VERSIONNUMFILE="../out/build_version_string.autogen"
|
PLISTFILE="../out/build_autogen_macos_Info.plist"
|
||||||
|
JARNAME="TerrarumBuild.jar"
|
||||||
|
|
||||||
if [ ! -d "../assets_release" ]; then
|
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
|
echo "'assets_release' does not exist; prepare the assets for the release and put them into the assets_release directory, exiting now." >&2
|
||||||
@@ -24,12 +25,7 @@ mkdir $DESTDIR/Contents/Resources
|
|||||||
cp AppIcon.icns $DESTDIR/Contents/Resources/AppIcon.icns
|
cp AppIcon.icns $DESTDIR/Contents/Resources/AppIcon.icns
|
||||||
cp $SRCFILES/Terrarum.sh $DESTDIR/Contents/MacOS/
|
cp $SRCFILES/Terrarum.sh $DESTDIR/Contents/MacOS/
|
||||||
chmod +x $DESTDIR/Contents/MacOS/Terrarum.sh
|
chmod +x $DESTDIR/Contents/MacOS/Terrarum.sh
|
||||||
|
cp $PLISTFILE $DESTDIR/Contents/Info.plist
|
||||||
# Prepare an plist
|
|
||||||
cp $SRCFILES/Info.plist $DESTDIR/Contents/
|
|
||||||
printf "\n<key>CFBundleVersion</key><string>" >> $DESTDIR/Contents/Info.plist
|
|
||||||
cat $VERSIONNUMFILE >> $DESTDIR/Contents/Info.plist
|
|
||||||
printf "</string>\n</dict></plist>" >> $DESTDIR/Contents/Info.plist
|
|
||||||
|
|
||||||
# Copy over a Java runtime
|
# Copy over a Java runtime
|
||||||
mkdir $DESTDIR/Contents/MacOS/out
|
mkdir $DESTDIR/Contents/MacOS/out
|
||||||
@@ -39,8 +35,9 @@ mv $DESTDIR/Contents/MacOS/out/$RUNTIME/bin/java $DESTDIR/Contents/MacOS/out/$RU
|
|||||||
# Copy over all the assets and a jarfile
|
# Copy over all the assets and a jarfile
|
||||||
cp -r "../assets_release" $DESTDIR/Contents/MacOS/
|
cp -r "../assets_release" $DESTDIR/Contents/MacOS/
|
||||||
mv $DESTDIR/Contents/MacOS/assets_release $DESTDIR/Contents/MacOS/assets
|
mv $DESTDIR/Contents/MacOS/assets_release $DESTDIR/Contents/MacOS/assets
|
||||||
cp "../out/TerrarumBuild.jar" $DESTDIR/Contents/MacOS/out/
|
cp "../out/$JARNAME" $DESTDIR/Contents/MacOS/out/
|
||||||
|
|
||||||
|
# zip everything
|
||||||
cd "out"
|
cd "out"
|
||||||
rm $APPDIR.zip
|
rm $APPDIR.zip
|
||||||
7z a -tzip $APPDIR.zip $APPDIR
|
7z a -tzip $APPDIR.zip $APPDIR
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ SRCFILES="terrarummac_x86"
|
|||||||
APPDIR="./TerrarumMac.x86.app"
|
APPDIR="./TerrarumMac.x86.app"
|
||||||
DESTDIR="out/$APPDIR"
|
DESTDIR="out/$APPDIR"
|
||||||
RUNTIME="runtime-osx-x86"
|
RUNTIME="runtime-osx-x86"
|
||||||
VERSIONNUMFILE="../out/build_version_string.autogen"
|
PLISTFILE="../out/build_autogen_macos_Info.plist"
|
||||||
|
JARNAME="TerrarumBuild.jar"
|
||||||
|
|
||||||
if [ ! -d "../assets_release" ]; then
|
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
|
echo "'assets_release' does not exist; prepare the assets for the release and put them into the assets_release directory, exiting now." >&2
|
||||||
@@ -24,12 +25,7 @@ mkdir $DESTDIR/Contents/Resources
|
|||||||
cp AppIcon.icns $DESTDIR/Contents/Resources/AppIcon.icns
|
cp AppIcon.icns $DESTDIR/Contents/Resources/AppIcon.icns
|
||||||
cp $SRCFILES/Terrarum.sh $DESTDIR/Contents/MacOS/
|
cp $SRCFILES/Terrarum.sh $DESTDIR/Contents/MacOS/
|
||||||
chmod +x $DESTDIR/Contents/MacOS/Terrarum.sh
|
chmod +x $DESTDIR/Contents/MacOS/Terrarum.sh
|
||||||
|
cp $PLISTFILE $DESTDIR/Contents/Info.plist
|
||||||
# Prepare an plist
|
|
||||||
cp $SRCFILES/Info.plist $DESTDIR/Contents/
|
|
||||||
printf "\n<key>CFBundleVersion</key><string>" >> $DESTDIR/Contents/Info.plist
|
|
||||||
cat $VERSIONNUMFILE >> $DESTDIR/Contents/Info.plist
|
|
||||||
printf "</string>\n</dict></plist>" >> $DESTDIR/Contents/Info.plist
|
|
||||||
|
|
||||||
# Copy over a Java runtime
|
# Copy over a Java runtime
|
||||||
mkdir $DESTDIR/Contents/MacOS/out
|
mkdir $DESTDIR/Contents/MacOS/out
|
||||||
@@ -39,8 +35,9 @@ mv $DESTDIR/Contents/MacOS/out/$RUNTIME/bin/java $DESTDIR/Contents/MacOS/out/$RU
|
|||||||
# Copy over all the assets and a jarfile
|
# Copy over all the assets and a jarfile
|
||||||
cp -r "../assets_release" $DESTDIR/Contents/MacOS/
|
cp -r "../assets_release" $DESTDIR/Contents/MacOS/
|
||||||
mv $DESTDIR/Contents/MacOS/assets_release $DESTDIR/Contents/MacOS/assets
|
mv $DESTDIR/Contents/MacOS/assets_release $DESTDIR/Contents/MacOS/assets
|
||||||
cp "../out/TerrarumBuild.jar" $DESTDIR/Contents/MacOS/out/
|
cp "../out/$JARNAME" $DESTDIR/Contents/MacOS/out/
|
||||||
|
|
||||||
|
# zip everything
|
||||||
cd "out"
|
cd "out"
|
||||||
rm $APPDIR.zip
|
rm $APPDIR.zip
|
||||||
7z a -tzip $APPDIR.zip $APPDIR
|
7z a -tzip $APPDIR.zip $APPDIR
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ cd "${0%/*}"
|
|||||||
SRCFILES="terrarumwindows_x86"
|
SRCFILES="terrarumwindows_x86"
|
||||||
DESTDIR="TerrarumWindows.x86"
|
DESTDIR="TerrarumWindows.x86"
|
||||||
RUNTIME="runtime-windows-x86"
|
RUNTIME="runtime-windows-x86"
|
||||||
|
RCFILE="../out/build_autogen_windows.rc"
|
||||||
|
JARNAME="TerrarumBuild.jar"
|
||||||
|
|
||||||
if [ ! -d "../assets_release" ]; then
|
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
|
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;
|
echo 'Mingw32 not found; please install mingw64-cross-gcc (or similar) to your system' >&2; exit 1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
x86_64-w64-mingw32-gcc -Os -s -o $DESTDIR/Terrarum.exe $SRCFILES/Terrarum.c || { echo 'Building EXE failed' >&2; exit 1; }
|
# Compile .rc
|
||||||
# TODO add icon to the exe (use x86_64-w64-mingw32-windres?)
|
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
|
# Copy over a Java runtime
|
||||||
mkdir $DESTDIR/out
|
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
|
# Copy over all the assets and a jarfile
|
||||||
cp -r "../assets_release" $DESTDIR/
|
cp -r "../assets_release" $DESTDIR/
|
||||||
mv $DESTDIR/assets_release $DESTDIR/assets
|
mv $DESTDIR/assets_release $DESTDIR/assets
|
||||||
cp "../out/TerrarumBuild.jar" $DESTDIR/out/
|
cp "../out/$JARNAME" $DESTDIR/out/
|
||||||
|
|
||||||
# Temporary solution: zip everything
|
# zip everything
|
||||||
rm "out/TerrarumWindows.x86.zip"
|
rm "out/$DESTDIR.zip"
|
||||||
zip -r -9 -l "out/TerrarumWindows.x86.zip" $DESTDIR
|
zip -r -9 -l "out/$DESTDIR.zip" $DESTDIR
|
||||||
rm -rf $DESTDIR || true
|
rm -rf $DESTDIR || true
|
||||||
echo "Build successful: $DESTDIR"
|
echo "Build successful: $DESTDIR"
|
||||||
|
|||||||
BIN
buildapp/icns.ico
Normal file
BIN
buildapp/icns.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.5 KiB |
@@ -1,6 +0,0 @@
|
|||||||
[Desktop Entry]
|
|
||||||
Name=Terrarum
|
|
||||||
Exec=AppRun
|
|
||||||
Icon=icns
|
|
||||||
Type=Application
|
|
||||||
Categories=Game;
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
[Desktop Entry]
|
|
||||||
Name=Terrarum
|
|
||||||
Exec=AppRun
|
|
||||||
Icon=icns
|
|
||||||
Type=Application
|
|
||||||
Categories=Game;
|
|
||||||
1
buildapp/terrarumwindows_x86/terrarum.rc
Normal file
1
buildapp/terrarumwindows_x86/terrarum.rc
Normal file
@@ -0,0 +1 @@
|
|||||||
|
1 ICON "icns.ico"
|
||||||
@@ -6,9 +6,67 @@ import java.io.File
|
|||||||
* Created by minjaesong on 2023-08-25.
|
* Created by minjaesong on 2023-08-25.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fun main() {
|
private fun writeWindowsRC(major: Int, minor: Int, patch: Int) {
|
||||||
val s = App.getVERSION_STRING()
|
val s = """1 ICON "icns.ico"
|
||||||
val f = File("./out/build_version_string.autogen")
|
VS_VERSION_INFO VERSIONINFO
|
||||||
|
FILEVERSION $major,$minor,$patch,0
|
||||||
|
PRODUCTVERSION $major,$minor,$patch,0
|
||||||
|
{
|
||||||
|
BLOCK "StringFileInfo"
|
||||||
|
{
|
||||||
|
BLOCK "040904b0"
|
||||||
|
{
|
||||||
|
VALUE "FileDescription", "${TerrarumAppConfiguration.GAME_NAME}\0"
|
||||||
|
VALUE "FileVersion", "${App.getVERSION_STRING()}\0"
|
||||||
|
VALUE "LegalCopyright", "${TerrarumAppConfiguration.COPYRIGHT_DATE_NAME}\0"
|
||||||
|
VALUE "OriginalFilename", "${TerrarumAppConfiguration.GAME_NAME}.exe\0"
|
||||||
|
VALUE "ProductName", "${TerrarumAppConfiguration.GAME_NAME}\0"
|
||||||
|
VALUE "ProductVersion", "${App.getVERSION_STRING()}\0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
BLOCK "VarFileInfo"
|
||||||
|
{
|
||||||
|
VALUE "Translation", 0x409, 1200
|
||||||
|
}
|
||||||
|
}"""
|
||||||
|
val f = File("./out/build_autogen_windows.rc")
|
||||||
f.delete()
|
f.delete()
|
||||||
f.writeText(s)
|
f.writeText(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun writeOSXPlist(major: Int, minor: Int, patch: Int) {
|
||||||
|
val s = """<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0"><dict>
|
||||||
|
<key>CFBundleExecutable</key><string>${TerrarumAppConfiguration.GAME_NAME}.sh</string>
|
||||||
|
<key>CFBundleDisplayName</key><string>${TerrarumAppConfiguration.GAME_NAME}</string>
|
||||||
|
<key>CFBundleName</key><string>${TerrarumAppConfiguration.GAME_NAME}</string>
|
||||||
|
<key>CFBundleIconFile</key><string>AppIcon.icns</string>
|
||||||
|
<key>CFBundleVersion</key><string>${App.getVERSION_STRING()}</string>
|
||||||
|
</dict></plist>"""
|
||||||
|
val f = File("./out/build_autogen_macos_Info.plist")
|
||||||
|
f.delete()
|
||||||
|
f.writeText(s)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun writeLinuxDesktop(major: Int, minor: Int, patch: Int) {
|
||||||
|
val s = """[Desktop Entry]
|
||||||
|
Name=${TerrarumAppConfiguration.GAME_NAME}
|
||||||
|
Exec=AppRun
|
||||||
|
Icon=icns
|
||||||
|
Type=Application
|
||||||
|
Categories=Game;"""
|
||||||
|
val f = File("./out/build_autogen_linux.desktop")
|
||||||
|
f.delete()
|
||||||
|
f.writeText(s)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun main() {
|
||||||
|
val major = (App.VERSION_RAW ushr 48).toInt()
|
||||||
|
val minor = ((App.VERSION_RAW and 0xffff000000L) ushr 24).toInt()
|
||||||
|
val patch = (App.VERSION_RAW and 0xffffffL).toInt()
|
||||||
|
|
||||||
|
writeLinuxDesktop(major, minor, patch)
|
||||||
|
writeOSXPlist(major, minor, patch)
|
||||||
|
writeWindowsRC(major, minor, patch)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user