more standalone TerranBASIC executable build files

This commit is contained in:
minjaesong
2023-04-15 00:48:14 +09:00
parent 9a4e28caa7
commit 9fa543af53
29 changed files with 3723 additions and 262 deletions

Binary file not shown.

28
buildapp/build_app_linux_arm.sh Executable file
View File

@@ -0,0 +1,28 @@
#!/bin/bash
cd "${0%/*}"
APPIMAGETOOL="appimagetool-x86_64.AppImage"
SRCFILES="tbaslinux_arm"
DESTDIR="TerranBASIC_linux.arm"
RUNTIME="runtime-linux-arm"
# Cleanup
rm -rf $DESTDIR || true
mkdir $DESTDIR
# Prepare an application
cp icns.png $DESTDIR/icns.png
cp $SRCFILES/TerranBASIC.desktop $DESTDIR/
cp $SRCFILES/AppRun $DESTDIR/AppRun
chmod +x $DESTDIR/AppRun
# Copy over a Java runtime
cp -r "../out/$RUNTIME" $DESTDIR/
# Copy over all the assets and a jarfile
cp -r "../out/TerranBASIC.jar" $DESTDIR/
# Pack everything to AppImage
"./$APPIMAGETOOL" $DESTDIR "out/$DESTDIR.AppImage" || { echo 'Building AppImage failed' >&2; exit 1; }
chmod +x "out/$DESTDIR.AppImage"
rm -rf $DESTDIR || true
echo "Build successful: $DESTDIR"

28
buildapp/build_app_linux_x86.sh Executable file
View File

@@ -0,0 +1,28 @@
#!/bin/bash
cd "${0%/*}"
APPIMAGETOOL="appimagetool-x86_64.AppImage"
SRCFILES="tbaslinux_x86"
DESTDIR="TerranBASIC_linux.x86"
RUNTIME="runtime-linux-x86"
# Cleanup
rm -rf $DESTDIR || true
mkdir $DESTDIR
# Prepare an application
cp icns.png $DESTDIR/icns.png
cp $SRCFILES/TerranBASIC.desktop $DESTDIR/
cp $SRCFILES/AppRun $DESTDIR/AppRun
chmod +x $DESTDIR/AppRun
# Copy over a Java runtime
cp -r "../out/$RUNTIME" $DESTDIR/
# Copy over all the assets and a jarfile
cp -r "../out/TerranBASIC.jar" $DESTDIR/
# Pack everything to AppImage
"./$APPIMAGETOOL" $DESTDIR "out/$DESTDIR.AppImage" || { echo 'Building AppImage failed' >&2; exit 1; }
chmod +x "out/$DESTDIR.AppImage"
rm -rf $DESTDIR || true
echo "Build successful: $DESTDIR"

24
buildapp/build_app_mac_arm.sh Executable file
View File

@@ -0,0 +1,24 @@
#!/bin/bash
cd "${0%/*}"
SRCFILES="tbasmac_arm"
DESTDIR="out/TerranBASIC_macOS.arm.app"
RUNTIME="runtime-osx-arm"
# Cleanup
rm -rf $DESTDIR || true
mkdir $DESTDIR
mkdir $DESTDIR/Contents
mkdir $DESTDIR/Contents/MacOS
# Prepare an application
cp icns.png $DESTDIR/.icns
cp $SRCFILES/Info.plist $DESTDIR/Contents/
cp $SRCFILES/TerranBASIC.sh $DESTDIR/Contents/MacOS/
chmod +x $DESTDIR/Contents/MacOS/TerranBASIC.sh
# Copy over a Java runtime
cp -r "../out/$RUNTIME" $DESTDIR/Contents/MacOS/
# Copy over all the assets and a jarfile
cp -r "../out/TerranBASIC.jar" $DESTDIR/Contents/MacOS/
echo "Build successful: $DESTDIR"

24
buildapp/build_app_mac_x86.sh Executable file
View File

@@ -0,0 +1,24 @@
#!/bin/bash
cd "${0%/*}"
SRCFILES="tbasmac_x86"
DESTDIR="out/TerranBASIC_macOS.x86.app"
RUNTIME="runtime-osx-x86"
# Cleanup
rm -rf $DESTDIR || true
mkdir $DESTDIR
mkdir $DESTDIR/Contents
mkdir $DESTDIR/Contents/MacOS
# Prepare an application
cp icns.png $DESTDIR/.icns
cp $SRCFILES/Info.plist $DESTDIR/Contents/
cp $SRCFILES/TerranBASIC.sh $DESTDIR/Contents/MacOS/
chmod +x $DESTDIR/Contents/MacOS/TerranBASIC.sh
# Copy over a Java runtime
cp -r "../out/$RUNTIME" $DESTDIR/Contents/MacOS/
# Copy over all the assets and a jarfile
cp -r "../out/TerranBASIC.jar" $DESTDIR/Contents/MacOS/
echo "Build successful: $DESTDIR"

View File

@@ -0,0 +1,23 @@
#!/bin/bash
cd "${0%/*}"
SRCFILES="tbaswindows_x86"
DESTDIR="TerranBASIC_windows.x86.exe"
RUNTIME="runtime-windows-x86"
# Cleanup
rm -rf $DESTDIR || true
mkdir $DESTDIR
# Prepare an application
cp $SRCFILES/TerranBASIC.bat $DESTDIR/
# Copy over a Java runtime
cp -r "../out/$RUNTIME" $DESTDIR/
# Copy over all the assets and a jarfile
cp -r "../out/TerranBASIC.jar" $DESTDIR/
# Temporary solution: zip everything
zip -r -9 -l "out/$DESTDIR.zip" $DESTDIR
rm -rf $DESTDIR || true
echo "Build successful: $DESTDIR"

BIN
buildapp/icns.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

61
buildapp/instructions.md Normal file
View File

@@ -0,0 +1,61 @@
### Preparation
Download and unzip the JDKs to ~/Documents/openjdk/* for the appropriate operating systems first! JDKs can be downloaded on https://jdk.java.net/archive/.
The filenames must be:
| Target OS/Arch | filename |
|---------------------|--------------------|
| Linux AMD64 | jdk-17.0.1-x86 |
| Linux Aarch64 | jdk-17.0.1-arm |
| Windows AMD64 | jdk-17.0.1-windows |
| macOS Apple Silicon | jdk-17.0.1.jdk-arm |
| macOS Intel | jdk-17.0.1.jdk-x86 |
Then, on the terminal, run following commands:
```
jlink --module-path ~/Documents/openjdk/jdk-17.0.1-x86/jmods:mods --add-modules java.base,java.desktop,java.logging,java.scripting,jdk.unsupported --output ~/Documents/Terrarum/out/runtime-linux-x86 --no-header-files --no-man-pages --strip-debug --compress=2
jlink --module-path ~/Documents/openjdk/jdk-17.0.1-arm/jmods:mods --add-modules java.base,java.desktop,java.logging,java.scripting,jdk.unsupported --output ~/Documents/Terrarum/out/runtime-linux-arm --no-header-files --no-man-pages --strip-debug --compress=2
jlink --module-path ~/Documents/openjdk/jdk-17.0.1-windows/jmods:mods --add-modules java.base,java.desktop,java.logging,java.scripting,jdk.unsupported --output ~/Documents/Terrarum/out/runtime-windows-x86 --no-header-files --no-man-pages --strip-debug --compress=2
jlink --module-path ~/Documents/openjdk/jdk-17.0.1.jdk-arm/Contents/Home/jmods:mods --add-modules java.base,java.desktop,java.logging,java.scripting,jdk.unsupported --output ~/Documents/Terrarum/out/runtime-osx-arm --no-header-files --no-man-pages --strip-debug --compress=2
jlink --module-path ~/Documents/openjdk/jdk-17.0.1.jdk-x86/Contents/Home/jmods:mods --add-modules java.base,java.desktop,java.logging,java.scripting,jdk.unsupported --output ~/Documents/Terrarum/out/runtime-osx-x86 --no-header-files --no-man-pages --strip-debug --compress=2
```
(note: matching the building machine with the target OS is highly recommended -- Use Linux for building linux x86/arm; Mac for building macOS x86/arm; Windows for building Windows Java Runtime)
This process assumes that the game does NOT use the Java 9+ modules and every single required libraries are fat-jar'd (their contents extracted right into the Jar)
### Packaging
Create an output directory if there is none (project root/buildapp/out)
Before running the packaging script make sure:
1. The required runtime must exist on `(project root)/out/runtime-<linux|osx|windows>-<arm|x86>` directory
2. The build scripts are on a subdirectory of the project directory
To build, **cd into the "(project root)/buildapp/", then execute the appropriate script**.
The packaged application can be found on `(project root)/buildapp/out/`
#### OSX .app Packaging
```
Terrarum.*.app
+.icns /* 512x512 PNG */
+Contents
`Info.plist
+MacOS
`start_game_mac_*.sh * permission: +x */
```
`assets/TerrarumBuild.jar` is the artifact built using the TerrarumBuild.
`start_game_*` files are on the root directory of the project; use them to build executable apps.
Hide the `.jar` within the subdirectory; users will think this file is the main executable and will try to execute it using whatever JVM they may (or may not) have.
### Notes to Terrarum Programmers
By self-containing everything in one file, it is not possible to modify the base game easily. Modloading scheme must be extended to load from mutable directory such as `%APPDATA%/Terrarum/mods`.

View File

@@ -0,0 +1,7 @@
You should be able to find following files here:
TerranBASIC_macOS.x86.app (a directory)
TerranBASIC_macOS.arm.app (a directory)
TerranBASIC_linux.x86.AppImage (an ELF executable)
TerranBASIC_linux.arm.AppImage (an ELF executable)
TerranBASIC_windows.x86.exe (a Windows executable)

3
buildapp/tbaslinux_arm/AppRun Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
cd "${0%/*}"
./runtime-linux-arm/bin/java -Xms128M -Xmx2G -Dswing.aatext=true -Dawt.useSystemAAFontSettings=lcd -jar ./TerranBASIC.jar

View File

@@ -0,0 +1,6 @@
[Desktop Entry]
Name=TerranBASIC
Exec=AppRun
Icon=icns
Type=Application
Categories=Game;

3
buildapp/tbaslinux_x86/AppRun Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
cd "${0%/*}"
./runtime-linux-x86/bin/java -Xms128M -Xmx2G -Dswing.aatext=true -Dawt.useSystemAAFontSettings=lcd -jar ./TerranBASIC.jar

View File

@@ -0,0 +1,6 @@
[Desktop Entry]
Name=TerranBASIC
Exec=AppRun
Icon=icns
Type=Application
Categories=Game;

View File

@@ -0,0 +1,7 @@
<?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>TerranBASIC.sh</string>
<key>CFBundleDisplayName</key><string>TerranBASIC</string>
<key>CFBundleName</key><string>TerranBASIC</string>
</dict></plist>

View File

@@ -0,0 +1,3 @@
#!/bin/bash
cd "${0%/*}"
./runtime-osx-arm/bin/java -XstartOnFirstThread -Xms128M -Xmx2G -jar ./TerranBASIC.jar

View File

@@ -0,0 +1,7 @@
<?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>TerranBASIC.sh</string>
<key>CFBundleDisplayName</key><string>TerranBASIC</string>
<key>CFBundleName</key><string>TerranBASIC</string>
</dict></plist>

View File

@@ -0,0 +1,3 @@
#!/bin/bash
cd "${0%/*}"
./runtime-osx-x86/bin/java -XstartOnFirstThread -Xms128M -Xmx2G -jar ./TerranBASIC.jar

View File

@@ -0,0 +1,2 @@
cd /D "%~dp0"
.\runtime-windows-x86\bin\java -Xms128M -Xmx2G -jar .\TerranBASIC.jar