Files
ARMSX2/.github/workflows/linux_build_libretro.yml
T
Brian Degenhardt fabccaa4fb libretro: rebrand core to armsx2_libretro, wire libretro+SDL CI into build-all
Rename the imported yaps2 libretro core (output .so, .info, core-option
prefixes, ini name, Vulkan app/engine identity) to ARMSX2. The core is
still gated behind ENABLE_LIBRETRO (default OFF) and needs X11_API=OFF
WAYLAND_API=OFF (headless Vulkan-context-negotiation build, same as the
CI job). Exports remain retro_* only via link.T.

The yaps2 nightly_release.yml is dropped — ARMSX2 has its own release
process — and the reusable libretro/SDL build workflows are instead
invoked from build-all.yml, so PR runs cover them. armsx2-sdl keeps the
kmsdrm handheld frontend buildable for Rocknix-style downstreams.
2026-07-19 10:37:07 -07:00

159 lines
6.0 KiB
YAML

name: Linux libretro Core Build Steps
# ARMSX2: builds the libretro core (armsx2_libretro.so) for RetroArch and
# other libretro frontends. The core is driven by the frontend's Vulkan
# context sharing (see pcsx2/GS/Renderers/Vulkan/VKLibretro.cpp), so it links
# no Qt and needs no X11/Wayland/SDL WSI. Packaged as a self-contained
# .tar.zst holding the stripped core .so. Native aarch64 build on a GitHub
# arm64 runner.
on:
workflow_call:
inputs:
jobName:
required: true
type: string
artifactPrefixName:
required: true
type: string
os:
required: false
type: string
default: ubuntu-22.04-arm
platform:
required: false
type: string
default: arm64
fetchTags:
required: false
type: boolean
default: false
jobs:
build_libretro:
name: ${{ inputs.jobName }}
runs-on: ${{ inputs.os }}
timeout-minutes: 90
env:
CCACHE_BASEDIR: ${{ github.workspace }}
CCACHE_DIR: ${{ github.workspace }}/.ccache
CCACHE_COMPRESS: true
CCACHE_COMPRESSLEVEL: 9
CCACHE_MAXSIZE: 100M
steps:
- name: Checkout Repository
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Fetch Tags
if: ${{ inputs.fetchTags }}
run: git fetch --tags --no-recurse-submodules
- name: Prepare Artifact Metadata
id: artifact-metadata
shell: bash
env:
PREFIX: ${{ inputs.artifactPrefixName }}
EVENT_NAME: ${{ github.event_name }}
PR_TITLE: ${{ github.event.pull_request.title }}
PR_NUM: ${{ github.event.pull_request.number }}
PR_SHA: ${{ github.event.pull_request.head.sha }}
run: ./.github/workflows/scripts/common/name-artifacts.sh
- name: Prepare ccache timestamp
id: ccache_cache_timestamp
run: echo "timestamp=$(date -u "+%Y-%m-%d-%H;%M;%S")" >> $GITHUB_OUTPUT
- name: ccache cache files
uses: actions/cache@v6
with:
path: .ccache
key: ${{ inputs.os }} ${{ inputs.platform }} libretro ccache ${{ steps.ccache_cache_timestamp.outputs.timestamp }}
restore-keys: ${{ inputs.os }} ${{ inputs.platform }} libretro ccache
- name: Install Packages
run: |
tools/retry.sh wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
sudo tools/retry.sh apt-add-repository -n 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main'
sudo tools/retry.sh apt-get update
sudo tools/retry.sh apt-get -y install \
build-essential ccache clang-17 cmake curl git lld-17 llvm-17 ninja-build nasm patchelf pkg-config zstd zlib1g-dev \
libasound2-dev libaio-dev libcurl4-openssl-dev libdbus-1-dev libdrm-dev libegl-dev libevdev-dev libgbm-dev \
libgudev-1.0-dev libinput-dev libopengl-dev libpcap-dev libpipewire-0.3-dev libpulse-dev libssl-dev libudev-dev \
libwayland-dev libx11-dev
- name: Cache Dependencies
id: cache-deps
uses: actions/cache@v6
with:
path: ~/deps
# Shares the SDL job's dependency cache — same dep set (superset).
key: ${{ inputs.os }} ${{ inputs.platform }} sdl-deps ${{ hashFiles('.github/workflows/scripts/linux/build-dependencies-runner.sh', '.github/workflows/scripts/common/*.patch') }}
- name: Build Dependencies
if: steps.cache-deps.outputs.cache-hit != 'true'
run: .github/workflows/scripts/linux/build-dependencies-runner.sh "$HOME/deps"
- name: Generate CMake
run: |
# The libretro core is a position-independent shared object driven by
# the frontend's Vulkan context — no Qt, no SDL, no X11/Wayland WSI.
# OVERRIDE_HOST_PAGE_SIZE=4096 is a first-cut default matching the
# common Android/handheld RetroArch target; revisit for 16K-page
# devices.
cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \
-DCMAKE_PREFIX_PATH="$HOME/deps" \
-DCMAKE_C_COMPILER=clang-17 \
-DCMAKE_CXX_COMPILER=clang++-17 \
-DCMAKE_EXE_LINKER_FLAGS_INIT="-fuse-ld=lld" \
-DCMAKE_MODULE_LINKER_FLAGS_INIT="-fuse-ld=lld" \
-DCMAKE_SHARED_LINKER_FLAGS_INIT="-fuse-ld=lld" \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DENABLE_QT_UI=OFF \
-DENABLE_SDL_FRONTEND=OFF \
-DENABLE_LIBRETRO=ON \
-DENABLE_GSRUNNER=OFF \
-DENABLE_TESTS=OFF \
-DENABLE_RECOMPILER_TEST_HOOKS=OFF \
-DENABLE_SETCAP=OFF \
-DUSE_BACKTRACE=OFF \
-DX11_API=OFF \
-DWAYLAND_API=OFF \
-DDISABLE_ADVANCE_SIMD=TRUE \
-DOVERRIDE_HOST_PAGE_SIZE=4096 \
-DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON
- name: Build armsx2_libretro
working-directory: build
run: |
ccache -p
ccache -z
ninja pcsx2-libretro
ccache -s
- name: Package libretro Core Tarball
env:
NAME: ${{ steps.artifact-metadata.outputs.artifact-name }}
run: |
SO=$(find build -name 'armsx2_libretro.so' | head -1)
test -n "$SO" || { echo "armsx2_libretro.so not found"; exit 1; }
# Keep the retro_* dynamic exports (link.T version script), drop the
# rest — the Devel/RelWithDebInfo .so is ~80 MB unstripped.
strip --strip-unneeded "$SO"
mkdir -p "pkg/${NAME}"
cp -v "$SO" "pkg/${NAME}/"
tar --zstd -C pkg -cf "${NAME}.tar.zst" "${NAME}"
mkdir -p "$GITHUB_WORKSPACE"/ci-artifacts/
mv "${NAME}.tar.zst" "$GITHUB_WORKSPACE"/ci-artifacts/
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: ${{ steps.artifact-metadata.outputs.artifact-name }}
path: ci-artifacts