name: Generate Linux AppImage on: push: branches: - master # For testing. #- test_arch tags: - "v*.*" paths-ignore: - '*.{txt,md}' - 'Tools/**' - '.{editorconfig,gitattributes,gitignore}' - 'appveyor.yml' pull_request: branches: - master paths-ignore: - '*.{txt,md}' - 'Tools/**' - '.{editorconfig,gitattributes,gitignore}' - 'appveyor.yml' env: SDL_AUDIODRIVER: "dummy" #"disk" #SDL_VIDEODRIVER: "dummy" #BUILD_CONFIGURATION: Release #RelWithDebInfo jobs: build: name: build (${{ matrix.id }}) strategy: fail-fast: false matrix: include: - os: ubuntu-24.04 id: x86_64 - os: ubuntu-24.04-arm id: aarch64 runs-on: ${{ matrix.os }} container: ghcr.io/pkgforge-dev/archlinux:latest env: CCACHE_DIR: ${{ github.workspace }}/.ccache CCACHE_COMPILERCHECK: content CCACHE_SLOPPINESS: time_macros steps: - name: Install git run: pacman -Syu --noconfirm git - uses: actions/checkout@v6 with: fetch-depth: 0 submodules: recursive - name: Check Valid Version Tags id: valid-tags shell: bash run: | # Fix dubious ownership issue when running git describe inside a container git config --global --add safe.directory "$PWD" # Alternatively, chown -R $(id -u):$(id -g) $PWD echo "count=$(git tag -l 'v[0-9]*' | wc -l | tr -d ' ')" >> $GITHUB_OUTPUT - name: Fetch upstream tags # required for git describe to return a valid version and to preevnt androidGitVersion from crashing on a new fork if: steps.valid-tags.outputs.count == '0' run: | # TODO: should try to fetch tags from whereever this repo was forked from before fetching from official repo git remote add upstream https://github.com/hrydgard/ppsspp.git # fetching from official repo as a fallback git fetch --deepen=15000 --no-recurse-submodules --tags --force upstream || exit 0 - name: Set up ccache for ${{ matrix.id }} uses: actions/cache@v5.0.4 with: path: ${{ env.CCACHE_DIR }} key: ${{ runner.os }}-ccache-${{ matrix.id }}-${{ github.sha }} restore-keys: | ${{ runner.os }}-ccache-${{ matrix.id }}- - name: Install dependencies shell: bash run: | #sudo su # Why sudo is needed? #sudo rm -rf /var/lib/apt/lists/lock # due to permisson issue, why there is such issue? # Debian-based #sudo apt-get update -y -qq #sudo apt-get install -q -y zsync patchelf xvfb strace #sudo apt-get install -q -y libstdc++6 ffmpeg libvulkan-dev libglew-dev libsdl2-ttf-dev libsdl2-dev libasound2-dev alsa-base alsa-utils libglu1-mesa pulseaudio linux-modules-extra-$(uname -r) #build-essential #plocate #sudo updatedb # to update locate database # Archlinux set -ex ARCH=$(uname -m) echo "ARCH=$ARCH" >> $GITHUB_ENV # Export ARCH to be reused on other steps EXTRA_PACKAGES="https://raw.githubusercontent.com/pkgforge-dev/Anylinux-AppImages/refs/heads/main/useful-tools/get-debloated-pkgs.sh" echo "Installing build dependencies..." echo "---------------------------------------------------------------" pacman -Syu --noconfirm \ base-devel \ curl \ git \ cmake \ ninja \ clang \ ccache \ lld \ libxss \ fontconfig \ gcc-libs \ glibc \ libc++ \ libc++abi \ glew \ sdl2_ttf \ python \ patchelf \ pipewire \ pipewire-audio \ pulseaudio \ pulseaudio-alsa \ strace \ wget \ xorg-server-xvfb \ zsync \ vulkan-headers \ alsa-lib sndio hidapi ibus jack libdecor libgl libpulse libusb \ libx11 libxcursor libxext libxinerama libxkbcommon libxrandr libxrender libxss libxtst \ wayland wayland-protocols echo "Installing debloated packages..." echo "---------------------------------------------------------------" wget --retry-connrefused --tries=30 "$EXTRA_PACKAGES" -O ./get-debloated-pkgs.sh chmod +x ./get-debloated-pkgs.sh ./get-debloated-pkgs.sh --add-mesa libxml2-mini opus-mini llvm-libs-nano - name: Build Release id: version env: CC: gcc #clang CXX: g++ #clang++ CPPFLAGS: -fno-pie -no-pie -static -Wl,-no_pie -Wl,-rpath,'$ORIGIN/../lib' -Wl,--disable-new-dtags -Wl,--no-undefined #-fno-unwind-tables -fno-exceptions -fno-threadsafe-statics -fno-rtti # -static-libgcc -static-libstdc++ # -fno-plt # -fPIC -D_XOPEN_SOURCE=700 #-D_GNU_SOURCE # -fno-split-stack #CXXFLAGS: -stdlib=libc++ -lc++abi # clang only LDFLAGS: -no-pie -static-libgcc -static-libstdc++ #-fuse-ld=lld #-static USE_CCACHE: 1 APPIMAGE_EXTRACT_AND_RUN: 1 run: | echo "Building..." uname -m echo "tag=$(git describe --always)" >> $GITHUB_OUTPUT # Export ccache env var(s) export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" export CCACHE_SLOPPINESS=clang_index_store,ivfsoverlay,include_file_ctime,include_file_mtime,modules,system_headers,time_macros gcc --version g++ --version #clang --version #clang++ --version # Install SDL2 from AUR sed -i 's|EUID == 0|EUID == 69|g' /usr/bin/makepkg # because the docker image is ran as root this is needed lol #git clone https://aur.archlinux.org/sdl2.git mkdir sdl2 pushd sdl2 cat <<-'EOF' > ./PKGBUILD # Maintainer: HurricanePootis # Contributor: Sven-Hendrik Haase pkgname=sdl2 pkgver=2.32.8 pkgrel=1 pkgdesc="A library for portable low-level access to a video framebuffer, audio output, mouse, and keyboard (Version 2)" arch=('x86_64') url="https://www.libsdl.org" license=('Zlib') provides=('sdl2-compat') conflicts=('sdl2-compat') depends=('glibc' 'libxext' 'libxrender' 'libx11' 'libgl' 'libxcursor' 'hidapi' 'libusb') makedepends=('alsa-lib' 'dbus' 'mesa' 'libpulse' 'libxrandr' 'libxinerama' 'wayland' 'libxkbcommon' 'wayland-protocols' 'ibus' 'libxss' 'cmake' 'jack' 'ninja' 'pipewire' 'libdecor' 'vulkan-driver' 'vulkan-headers' 'libsamplerate') optdepends=('alsa-lib: ALSA audio driver' 'libpulse: PulseAudio audio driver' 'jack: JACK audio driver' 'pipewire: PipeWire audio driver' 'libdecor: Wayland client decorations') source=("https://github.com/libsdl-org/SDL/releases/download/release-${pkgver}/SDL2-${pkgver}.tar.gz") sha512sums=('484c33638e7bd1002815bb1f6a47a292d1eaf0b963598dde65f4a3e077dfe75ee35b9ea4b3b767365b3ef4f613c4d69ce55b5e96675de562994344e83a978272') prepare(){ cd "$srcdir/SDL2-$pkgver" } build() { CFLAGS+=" -ffat-lto-objects" cmake -S SDL2-${pkgver} -B build -G Ninja \ -D CMAKE_INSTALL_PREFIX=/usr \ -D SDL_STATIC=OFF \ -D SDL_RPATH=OFF cmake --build build } package() { DESTDIR="${pkgdir}" cmake --install build # For some reason, this isn't named correctly and we have to fix it to reflect the actual staticlib name. sed -i "s/libSDL2\.a/libSDL2main.a/g" "$pkgdir"/usr/lib/cmake/SDL2/SDL2Targets-noconfig.cmake install -Dm644 SDL2-${pkgver}/LICENSE.txt "$pkgdir/usr/share/licenses/$pkgname/LICENSE" } # vim:set ts=2 sw=2 et: EOF sed -i "s|x86_64|$ARCH|" ./PKGBUILD makepkg -f pacman --noconfirm -Rsndd sdl2-compat pacman --noconfirm -U *.pkg.tar.* popd # End of Install SDL2 from AUR # Build ppsspp #./b.sh --release --no-sdl2 --no-png mkdir -p build pushd build cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DUSE_SYSTEM_LIBSDL2=OFF -DUSE_SYSTEM_LIBPNG=OFF -DUSE_SYSTEM_FFMPEG=OFF -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache .. make -j$(nproc) popd ccache -s -v - name: Create AppImage shell: bash run: | # Use dummy soundcard #sudo locate snd-dummy #sudo modprobe snd-dummy fake_buffer=0 # Test for missing modules ldd ./build/PPSSPPSDL # Create AppImage package echo "Creating AppImage..." chmod +x ./build/PPSSPPSDL chmod +x ./scripts/makeappimage_64-bit.sh VERSION=$([[ ${GITHUB_REF_TYPE} == tag ]] && echo "$GITHUB_REF_NAME" || echo "${{ steps.version.outputs.tag }}") echo "Version = $VERSION" ./scripts/makeappimage_64-bit.sh "$VERSION" - name: Prepare artifacts run: | find . -name "PPSSPPSDL" find . -name "PPSSPP*.AppImage" -exec chmod +x '{}' \; find . -name "PPSSPP*.AppBundle" -exec chmod +x '{}' \; find . -name "PPSSPP*.zsync" mkdir artifacts if [ -e ./PPSSPP*.AppImage ]; then cp -a ./PPSSPP*.AppImage artifacts/ fi if [ -e ./PPSSPP*.AppBundle ]; then cp -a ./PPSSPP*.AppBundle artifacts/ fi if [ -e ./PPSSPP*.zsync ]; then cp ./PPSSPP*.zsync artifacts/ fi - name: Upload artifacts uses: actions/upload-artifact@v7 with: name: linux-${{ steps.version.outputs.tag }}-${{ matrix.id }} AppImage path: artifacts/ - name: Upload release uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe # v2.6.1 if: github.ref_type == 'tag' with: token: ${{ secrets.GITHUB_TOKEN }} files: | artifacts/*.AppImage artifacts/*.AppImage.zsync