From 1ebca42f46712293a38a571ab46285a23e9fc2e6 Mon Sep 17 00:00:00 2001 From: th-2021 <90853655+th-2021@users.noreply.github.com> Date: Fri, 5 Aug 2022 07:59:19 +0200 Subject: Move to cmake across all platforms (#363) --- scripts/linux/appimage/build.sh | 7 +++++ scripts/linux/appimage/soh.desktop | 9 ++++++ scripts/linux/appimage/soh.sh | 57 ++++++++++++++++++++++++++++++++++++++ scripts/linux/build-appimage.sh | 34 ----------------------- scripts/linux/build.sh | 11 -------- scripts/linux/soh.desktop | 9 ------ scripts/linux/soh.sh | 57 -------------------------------------- scripts/switch/build.sh | 7 +++-- 8 files changed, 78 insertions(+), 113 deletions(-) create mode 100755 scripts/linux/appimage/build.sh create mode 100644 scripts/linux/appimage/soh.desktop create mode 100644 scripts/linux/appimage/soh.sh delete mode 100755 scripts/linux/build-appimage.sh delete mode 100755 scripts/linux/build.sh delete mode 100644 scripts/linux/soh.desktop delete mode 100644 scripts/linux/soh.sh (limited to 'scripts') diff --git a/scripts/linux/appimage/build.sh b/scripts/linux/appimage/build.sh new file mode 100755 index 000000000..bad6b00c5 --- /dev/null +++ b/scripts/linux/appimage/build.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +cmake --no-warn-unused-cli -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE:STRING=Release +cmake --build build-cmake --target ExtractAssets -- +cmake --build build-cmake --config Release -- + +(cd build-cmake && cpack -G External) diff --git a/scripts/linux/appimage/soh.desktop b/scripts/linux/appimage/soh.desktop new file mode 100644 index 000000000..b1fc2696b --- /dev/null +++ b/scripts/linux/appimage/soh.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Version=1.0 +Name=SOH +Exec=soh.sh +Terminal=false +Icon=sohIcon +Type=Application +Categories=Game; +Name[en_US]= diff --git a/scripts/linux/appimage/soh.sh b/scripts/linux/appimage/soh.sh new file mode 100644 index 000000000..f3b563cc7 --- /dev/null +++ b/scripts/linux/appimage/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 $ROMHASH 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 diff --git a/scripts/linux/build-appimage.sh b/scripts/linux/build-appimage.sh deleted file mode 100755 index 053ce580a..000000000 --- a/scripts/linux/build-appimage.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/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 deleted file mode 100755 index f9d1f9e2c..000000000 --- a/scripts/linux/build.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/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 deleted file mode 100644 index a637d03c3..000000000 --- a/scripts/linux/soh.desktop +++ /dev/null @@ -1,9 +0,0 @@ -[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 deleted file mode 100644 index f3b563cc7..000000000 --- a/scripts/linux/soh.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/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 $ROMHASH 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 diff --git a/scripts/switch/build.sh b/scripts/switch/build.sh index e5d65d99d..b5b137652 100755 --- a/scripts/switch/build.sh +++ b/scripts/switch/build.sh @@ -1,4 +1,7 @@ #!/bin/bash -make setup -C soh -j$(nproc) OPTFLAGS=-O2 DEBUG=0 -make -f Makefile.switch -j$(nproc) +cmake --no-warn-unused-cli -H. -Bbuild-linux -GNinja +cmake --build build-linux --target ExtractAssets + +cmake -H. -Bbuild-switch -GNinja -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/Switch.cmake +cmake --build build-switch --target soh_nro -- cgit v1.2.3