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"
|
||||
DESTDIR="TerrarumLinux.arm"
|
||||
RUNTIME="runtime-linux-arm"
|
||||
DESKTOPFILE="../out/build_autogen_linux.desktop"
|
||||
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
|
||||
@@ -18,7 +20,7 @@ mkdir $DESTDIR
|
||||
|
||||
# Prepare an application
|
||||
cp icns.png $DESTDIR/icns.png
|
||||
cp $SRCFILES/Terrarum.desktop $DESTDIR/
|
||||
cp $DESKTOPFILE $DESTDIR/
|
||||
cp $SRCFILES/AppRun $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
|
||||
cp -r "../assets_release" $DESTDIR/
|
||||
mv $DESTDIR/assets_release $DESTDIR/assets
|
||||
cp "../out/TerrarumBuild.jar" $DESTDIR/out/
|
||||
cp "../out/$JARNAME" $DESTDIR/out/
|
||||
|
||||
# Pack everything to AppImage
|
||||
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"
|
||||
DESTDIR="TerrarumLinux.x86"
|
||||
RUNTIME="runtime-linux-x86"
|
||||
DESKTOPFILE="../out/build_autogen_linux.desktop"
|
||||
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
|
||||
@@ -18,7 +20,7 @@ mkdir $DESTDIR
|
||||
|
||||
# Prepare an application
|
||||
cp icns.png $DESTDIR/icns.png
|
||||
cp $SRCFILES/Terrarum.desktop $DESTDIR/
|
||||
cp $DESKTOPFILE $DESTDIR/
|
||||
cp $SRCFILES/AppRun $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
|
||||
cp -r "../assets_release" $DESTDIR/
|
||||
mv $DESTDIR/assets_release $DESTDIR/assets
|
||||
cp "../out/TerrarumBuild.jar" $DESTDIR/out/
|
||||
cp "../out/$JARNAME" $DESTDIR/out/
|
||||
|
||||
# Pack everything to AppImage
|
||||
"./$APPIMAGETOOL" $DESTDIR "out/$DESTDIR.AppImage" || { echo 'Building AppImage failed' >&2; exit 1; }
|
||||
|
||||
@@ -6,7 +6,8 @@ SRCFILES="terrarummac_arm"
|
||||
APPDIR="./TerrarumMac.arm.app"
|
||||
DESTDIR="out/$APPDIR"
|
||||
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
|
||||
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 $SRCFILES/Terrarum.sh $DESTDIR/Contents/MacOS/
|
||||
chmod +x $DESTDIR/Contents/MacOS/Terrarum.sh
|
||||
|
||||
# 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
|
||||
cp $PLISTFILE $DESTDIR/Contents/Info.plist
|
||||
|
||||
# Copy over a Java runtime
|
||||
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
|
||||
cp -r "../assets_release" $DESTDIR/Contents/MacOS/
|
||||
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"
|
||||
rm $APPDIR.zip
|
||||
7z a -tzip $APPDIR.zip $APPDIR
|
||||
|
||||
@@ -6,7 +6,8 @@ SRCFILES="terrarummac_x86"
|
||||
APPDIR="./TerrarumMac.x86.app"
|
||||
DESTDIR="out/$APPDIR"
|
||||
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
|
||||
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 $SRCFILES/Terrarum.sh $DESTDIR/Contents/MacOS/
|
||||
chmod +x $DESTDIR/Contents/MacOS/Terrarum.sh
|
||||
|
||||
# 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
|
||||
cp $PLISTFILE $DESTDIR/Contents/Info.plist
|
||||
|
||||
# Copy over a Java runtime
|
||||
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
|
||||
cp -r "../assets_release" $DESTDIR/Contents/MacOS/
|
||||
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"
|
||||
rm $APPDIR.zip
|
||||
7z a -tzip $APPDIR.zip $APPDIR
|
||||
|
||||
@@ -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"
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
fun main() {
|
||||
val s = App.getVERSION_STRING()
|
||||
val f = File("./out/build_version_string.autogen")
|
||||
private fun writeWindowsRC(major: Int, minor: Int, patch: Int) {
|
||||
val s = """1 ICON "icns.ico"
|
||||
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.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