Files
ppsspp/.github/workflows/appimage.yml
T
Henrik RydgårdandClaude Opus 5.5 d0e3141f43 FFmpeg: Vendor what PPSSPP uses into ext/ffmpeg, drop the submodule
The ffmpeg submodule held prebuilt libraries for every platform next to the
sources (about 1.5 GB checked out), and nothing uses those any more. Only the
needed sources are copied in, from the submodule's commit, along with every
header and template they include. The path is new, so checking out commits on
either side of this works.

It's also cut down to what PPSSPP uses: the H.264, AAC, MP3, ATRAC3 and ATRAC3+
decoders, the H.264 parser, the demuxers as before, and the FFV1 encoder, AVI
muxer and file protocol for AVI dumping. config.h takes its CONFIG_ values from
FFmpeg 3.0.2's own configure run with just those enabled. The raw H.264 demuxer
stays even though nothing opens raw H.264: probing PSMF data uses it to identify
the video stream's codec, which otherwise comes out as none.

On top of that:
- The files nothing links (configure would build them, but they're never pulled
  out of the static library, going by the GCC link map) are left out: mostly
  libavutil's crypto and hashing and the alternative DCT/IDCT/FFT versions.
- libswresample isn't built, now that nothing uses it.
- The H.264 decoder only does 8-bit video, which is all the PSP has. The SPS
  parser rejects any other bit depth, and the DSP files no longer build their 9-
  to 16-bit variants, which the linker kept because the init functions pick one
  by bit depth at run time.

That's 160 files to compile instead of 277, and 391 of FFmpeg's vendored, about
5.8 MB. The README in ext/ffmpeg has what was done, the PPSSPP patches in the
copy, how to add a component, and the tradeoffs.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-25 22:27:54 +01:00

253 lines
8.9 KiB
YAML

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
# Unlimited, a cache once reached 1.2 GB.
CCACHE_MAXSIZE: 500M
CCACHE_COMPILERCHECK: content
CCACHE_SLOPPINESS: time_macros
steps:
# The pkgforge mirror often drops a download partway, so retry the whole transaction.
- name: Install git
shell: bash
run: |
for i in 1 2 3 4 5; do
pacman -Syu --noconfirm git && exit 0
sleep 20
done
exit 1
- uses: actions/checkout@v7
with:
fetch-depth: 0
- 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: Check out submodules
shell: bash
run: |
# The container runs as another user than the one that owns the checkout.
git config --global --add safe.directory '*'
.github/checkout-submodules.sh
# Only master saves the cache (see build.yml), so restoring and saving are separate.
- name: Set up ccache for ${{ matrix.id }}
uses: actions/cache/restore@v6.1.0
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
env:
# get-debloated-pkgs.sh queries the GitHub API, which rate-limits unauthenticated
# requests per runner IP. It then sleeps 10 minutes and usually fails anyway.
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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"
retry() {
for i in 1 2 3 4 5; do
"$@" && return 0
sleep 20
done
return 1
}
echo "Installing build dependencies..."
echo "---------------------------------------------------------------"
retry pacman -Syu --noconfirm \
base-devel \
curl \
git \
cmake \
ninja \
clang \
ccache \
lld \
libxss \
fontconfig \
gcc-libs \
glibc \
libc++ \
libc++abi \
glew \
sdl3 \
sdl3_ttf \
fribidi \
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
# Build ppsspp
#./b.sh --release --no-sdl2 --no-png
mkdir -p build
pushd build
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHEADLESS=ON -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: Save ccache for ${{ matrix.id }}
if: github.ref == 'refs/heads/master'
uses: actions/cache/save@v6.1.0
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ runner.os }}-ccache-${{ matrix.id }}-${{ github.sha }}
- 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
ldd ./build/PPSSPPHeadless
# 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
# There's more than one AppImage (PPSSPP and PPSSPPHeadless), so no [ -e glob ].
find . -maxdepth 1 \( -name "PPSSPP*.AppImage" -o -name "PPSSPP*.AppBundle" -o -name "PPSSPP*.zsync" \) -exec cp -a '{}' artifacts/ \;
ls -l artifacts/
- 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@efb35369e0ad2afab669f228072c1b0d510eae64 # v3.0.3
if: github.ref_type == 'tag'
with:
token: ${{ secrets.GITHUB_TOKEN }}
files: |
artifacts/*.AppImage
artifacts/*.AppImage.zsync