diff options
| author | David Chavez <david@dcvz.io> | 2022-08-02 16:22:20 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-02 16:22:20 +0200 |
| commit | 61c68666d622bddf1c8964cb3160ce5d0198af74 (patch) | |
| tree | 9dfa9e03a168ce60373b77e6f455ec469c6acd45 /scripts/linux | |
| parent | 4ed82c71dc9e24748cb06a6c70f4d52e87372ecc (diff) | |
Closer align Makefiles & Dockerfiles (#748)
Diffstat (limited to 'scripts/linux')
| -rwxr-xr-x | scripts/linux/build-appimage.sh | 34 | ||||
| -rwxr-xr-x | scripts/linux/build.sh | 11 | ||||
| -rw-r--r-- | scripts/linux/soh.desktop | 9 | ||||
| -rw-r--r-- | scripts/linux/soh.sh | 57 |
4 files changed, 111 insertions, 0 deletions
diff --git a/scripts/linux/build-appimage.sh b/scripts/linux/build-appimage.sh new file mode 100755 index 000000000..053ce580a --- /dev/null +++ b/scripts/linux/build-appimage.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +curl -sSfLO "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage" +chmod a+x linuxdeploy*.AppImage +curl -sSfL https://github.com$(curl https://github.com/probonopd/go-appimage/releases | grep "mkappimage-.*-x86_64.AppImage" | head -n 1 | cut -d '"' -f 2) -o mkappimage.AppImage +chmod a+x mkappimage.AppImage + +mkdir -p AppDir/usr/bin +cp scripts/linux/{soh.desktop,soh.sh} AppDir/ +cp soh/macosx/sohIcon.png AppDir/soh.png +curl -sSfL https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt -o AppDir/usr/bin/gamecontrollerdb.txt + +mkdir -p AppDir/usr/share/applications +mkdir -p AppDir/usr/share/icons/hicolor/scalable/apps +mkdir -p AppDir/usr/lib + +mv AppDir/soh.sh AppDir/usr/bin +cp -r build/* AppDir/usr/bin + +chmod +x AppDir/usr/bin/{soh.elf,OTRGui,soh.sh} + +cd AppDir && ln -s ./usr/bin/soh.sh ./AppRun && cd .. + +export UPD_INFO="gh-releases-zsync|HarbourMasters|Shipwright-linux|develop|SOH-Linux.AppImage.zsync" +./linuxdeploy-x86_64.AppImage --appimage-extract-and-run \ + --appdir=./AppDir/ \ + -d ./AppDir/soh.desktop \ + -i ./AppDir/soh.png \ + -e ./AppDir/usr/bin/soh.elf + +cd /soh + +VERSION=Linux ./mkappimage.AppImage --appimage-extract-and-run ./AppDir # "SOH-Linux-x86_64.AppImage" +mv SOH-Linux-x86_64.AppImage SOH-Linux.AppImage # Keep Original Name diff --git a/scripts/linux/build.sh b/scripts/linux/build.sh new file mode 100755 index 000000000..f9d1f9e2c --- /dev/null +++ b/scripts/linux/build.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +cd soh +make setup -j$(nproc) OPTFLAGS=-O2 DEBUG=0 +make -j$(nproc) OPTFLAGS=-O2 DEBUG=0 + +cd ../OTRGui +mkdir build +cd build +cmake .. +cmake --build . --config Release diff --git a/scripts/linux/soh.desktop b/scripts/linux/soh.desktop new file mode 100644 index 000000000..a637d03c3 --- /dev/null +++ b/scripts/linux/soh.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Version=1.0 +Name=SOH +Exec=AppRun +Terminal=false +Icon=soh +Type=Application +Categories=Game; +Name[en_US]= diff --git a/scripts/linux/soh.sh b/scripts/linux/soh.sh new file mode 100644 index 000000000..f3b563cc7 --- /dev/null +++ b/scripts/linux/soh.sh @@ -0,0 +1,57 @@ +#!/bin/bash +HERE="$(dirname "$(readlink -f "${0}")")"/../.. + +export PATH="$HERE"/bin:"$HERE"/usr/bin:"$PATH" +export LD_LIBRARY_PATH="$HERE"/usr/lib:"$LD_LIBRARY_PATH" +export ZENITY=$(command -v zenity) + +while [[ ! -e "$PWD"/oot.otr ]]; do + export ASSETDIR="$(mktemp -d /tmp/assets-XXXXX)" + ln -s "$HERE"/usr/bin/{assets,soh.elf,OTRGui} "$ASSETDIR" + export OLDPWD="$PWD" + mkdir -p "$ASSETDIR"/tmp + mkdir -p "$ASSETDIR"/Extract/assets + if [ -e "$PWD"/*.*64 ]; then + ln -s "$OLDPWD"/*.*64 "$ASSETDIR"/tmp/rom.z64 + cp -r "$ASSETDIR"/assets/game/ship_of_harkinian "$ASSETDIR"/Extract/assets/ + cd "$ASSETDIR" + ROMHASH=$(sha1sum -b "$ASSETDIR"/tmp/rom.z64 | awk '{ print $1 }') + case "$ROMHASH" in + cee6bc3c2a634b41728f2af8da54d9bf8cc14099) + ROM=GC_NMQ_D;; + 0227d7c0074f2d0ac935631990da8ec5914597b4) + ROM=GC_NMQ_PAL_F;; + *) + if [ -n "$ZENITY" ]; then + zenity --error --timeout=10 --text="ROM hash <b>$ROMHASH</b> does not match" --title="Incorrect ROM file" --width=500 --width=200 + else + echo -e "\nrom hash does not match\n" + fi + exit;; + esac + if [ -n "$ZENITY" ]; then + (echo "# 25%"; echo "25"; sleep 2; echo "# 50%"; echo "50"; sleep 3; echo "# 75%"; echo "75"; sleep 2; echo "# 100%"; echo "100"; sleep 3) | + zenity --progress --title="OTR Generating..." --timeout=10 --percentage=0 --icon-name=soh --window-icon=soh.png --height=80 --width=400 & + else + echo "Processing..." + fi + assets/extractor/ZAPD.out ed -eh -i assets/extractor/xmls/"${ROM}" -b tmp/rom.z64 -fl assets/extractor/filelists -o placeholder -osf placeholder -gsf 1 -rconf assets/extractor/Config_"${ROM}".xml -se OTR > /dev/null 2>&1 + cp "$ASSETDIR"/oot.otr "$OLDPWD" + echo "Restart $APPIMAGE to play!" + sleep 3 + rm -r "$ASSETDIR" + break + else + if [ -n "$ZENITY" ]; then + zenity --error --timeout=5 --text="Place ROM in $OWD" --title="Missing ROM file" --width=500 --width=200 + else + echo -e "\nPlace ROM in this folder\n" + fi + exit + fi +done + cd "$OWD" + ln -s "$HERE"/usr/bin/gamecontrollerdb.txt "$PWD" + "$HERE"/usr/bin/soh.elf + unlink "$PWD"/gamecontrollerdb.txt +exit |
