From fd0fb25de18ee327caab2f975468cc80c5f23384 Mon Sep 17 00:00:00 2001 From: qurious-pixel <62252937+qurious-pixel@users.noreply.github.com> Date: Tue, 5 Jul 2022 18:10:14 -0700 Subject: [PATCH] [CI] Create an Appimage for 64bit builds (#570) * [CI] Create AppImage file * [CI] Updated Jenkinsfile * [MISC] fix indentation * [MISC] Fix indentation * [MISC] Fix indentation * [CI] 7z appimage and readme --- Dockerfile | 68 ++++++++++++++++++++++++------------------- Jenkinsfile | 9 +++--- appimage/appimage.sh | 37 +++++++++++++++++++++++ appimage/soh.desktop | 9 ++++++ appimage/soh.sh | 41 ++++++++++++++++++++++++++ libultraship/Makefile | 1 + 6 files changed, 131 insertions(+), 34 deletions(-) create mode 100755 appimage/appimage.sh create mode 100644 appimage/soh.desktop create mode 100644 appimage/soh.sh diff --git a/Dockerfile b/Dockerfile index e981cf573..90e3d11c7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,38 +1,46 @@ - - -FROM ubuntu:21.04 as build +FROM ubuntu:20.04 as build ENV LANG C.UTF-8 ARG DEBIAN_FRONTEND=noninteractive -RUN dpkg --add-architecture i386 && \ - apt-get update && \ - apt-get upgrade -y && \ - apt-get install -y \ - binutils:i386 \ - gcc-10:i386 \ - g++-10:i386 \ - python3.10 \ - python \ - make \ - cmake \ - git \ - lld \ - libsdl2-dev:i386 \ - zlib1g-dev:i386 \ - libbz2-dev:i386 \ - libpng-dev:i386 \ - libgles2-mesa-dev && \ - ln -sf /usr/bin/python3.10 /usr/bin/python3 && \ - ln -s /usr/bin/gcc-10 /usr/bin/gcc && \ - ln -s /usr/bin/gcc-10 /usr/bin/cc && \ - ln -s /usr/bin/g++-10 /usr/bin/g++ && \ - ln -s /usr/bin/g++-10 /usr/bin/c++ - +RUN apt-get update && \ + apt-get upgrade -y && \ + apt-get install -y \ + binutils \ + gcc-10 \ + g++-10 \ + p7zip-full \ + python3.9 \ + make \ + cmake \ + curl \ + git \ + lld \ + libsdl2-dev \ + zlib1g-dev \ + libbz2-dev \ + libpng-dev \ + libgles2-mesa-dev && \ + ln -s /usr/bin/g++-10 /usr/bin/g++ && \ + update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10 && \ + gcc --version && \ + g++ --version + +RUN apt-get clean autoclean && apt-get autoremove --yes && rm -rf /var/lib/apt /var/lib/cache /var/lib/log + RUN git clone https://github.com/Perlmint/glew-cmake.git && \ - cmake glew-cmake && \ - make -j$(nproc) && \ - make install ARCH64=false + cmake glew-cmake && \ + make -j$(nproc) && \ + make install + +ENV SDL2VER=2.0.22 +RUN curl -sLO https://libsdl.org/release/SDL2-${SDL2VER}.tar.gz && \ + tar -xzf SDL2-${SDL2VER}.tar.gz && \ + cd SDL2-${SDL2VER} && \ + ./configure --prefix=/usr && \ + make && make install && \ + rm ../SDL2-${SDL2VER}.tar.gz && \ + cp -av /lib/libSDL* /lib/x86_64-linux-gnu/ RUN mkdir /soh WORKDIR /soh diff --git a/Jenkinsfile b/Jenkinsfile index 6fcca055a..b4cfd3167 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -104,10 +104,11 @@ pipeline { mv OTRGui/build/OTRGui build/ mv OTRGui/build/assets build/ mv ZAPDTR/ZAPD.out build/assets/extractor/ - mv README.md build/readme.txt - cd build - 7z a soh-linux.7z soh.elf OTRGui assets readme.txt - mv soh-linux.7z ../ + mv README.md readme.txt + + docker exec sohcont appimage/appimage.sh + + 7z a soh-linux.7z SOH-Linux.AppImage readme.txt ''' } diff --git a/appimage/appimage.sh b/appimage/appimage.sh new file mode 100755 index 000000000..42c54576a --- /dev/null +++ b/appimage/appimage.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +curl -sSfLO "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage" +chmod a+x linuxdeploy*.AppImage +curl -sSfLO "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" +chmod a+x appimagetool*.AppImage + +mkdir -p AppDir/usr/bin +cp appimage/{soh.desktop,soh.png,soh.sh} AppDir/ +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|zelda64|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 \ + -e ./AppDir/usr/bin/assets/extractor/ZAPD.out + +mv ./AppDir/usr/bin/ZAPD.out ./AppDir/usr/bin/assets/extractor/ZAPD.out +cd ./AppDir/usr/bin/assets/extractor/ +patchelf --set-rpath "\$ORIGIN/../../../lib" ZAPD.out +cd /soh + +./appimagetool-x86_64.AppImage --appimage-extract-and-run ./AppDir "SOH-Linux.AppImage" -u "gh-releases-zsync|HarbourMasters|Shipwright-linux|zelda64|SOH-Linux.AppImage.zsync" + diff --git a/appimage/soh.desktop b/appimage/soh.desktop new file mode 100644 index 000000000..a637d03c3 --- /dev/null +++ b/appimage/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/appimage/soh.sh b/appimage/soh.sh new file mode 100644 index 000000000..29a7841c4 --- /dev/null +++ b/appimage/soh.sh @@ -0,0 +1,41 @@ +#!/bin/bash +HERE="$(dirname "$(readlink -f "${0}")")"/../.. + +export PATH=$HERE/bin:$HERE/usr/bin:$PATH + +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 + case $(sha1sum -b $ASSETDIR/tmp/rom.z64 | awk '{ print $1 }') in + cee6bc3c2a634b41728f2af8da54d9bf8cc14099) + ROM=GC_NMQ_D;; + 0227d7c0074f2d0ac935631990da8ec5914597b4) + ROM=GC_NMQ_PAL_F;; + *) + echo -e "\nrom hash does not match\n" + exit;; + esac + echo "Processing..." + 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 + echo -e "\nPlace ROM in this folder\n" + 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/libultraship/Makefile b/libultraship/Makefile index d894514b6..9dd148821 100644 --- a/libultraship/Makefile +++ b/libultraship/Makefile @@ -17,6 +17,7 @@ WARN := -Wall -Wextra -Werror \ -Wno-unused-function \ -Wno-parentheses \ -Wno-narrowing \ + -Wno-error=stringop-overflow \ -Wno-missing-field-initializers \ -Wno-error=multichar