Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

329.1. retroarch-1.22.2

The libretro frontend: one window, one menu and one set of controls for every emulator core

Version 1.22.2, release 2
Shelf libretro — RetroArch, its assets, databases and libretro cores
Phase 44_apps (Applications), 271 of 422 in build order
Licence GPL-3.0-or-later
Homepage https://www.retroarch.com
Build time 4.1 SBU
Installed size 10.9 MiB in 10 files
Recipe ports/core/libretro/retroarch/kpkgbuild

About

RetroArch is the libretro frontend: one window, one menu, one set of controller bindings, save states, shaders and netplay for every emulator and game engine built as a libretro core. In KDOS the cores, assets, core information files, databases and controller profiles are ports of their own, installed under /usr/lib/libretro and /usr/share/libretro, and RetroArch is pointed at them.

Sources

Dependencies

Depends on: pkgconf, librsvg, mesa, libglvnd, wayland, wayland-protocols, libxkbcommon, libdecor, libdrm, vulkan-loader, vulkan-headers, alsa-lib, libpulse, pipewire, eudev, libusb, sdl2-compat, freetype2, zlib, retroarch-assets, libretro-core-info, libretro-database, retroarch-joypad-autoconfig, v4l-utils.

Required by: no port names it.

Optional, off in KDOS

These switches in build.sh turn off a feature whose library is a port here. The recipe may turn each off on purpose, or because the library was not yet a port when the recipe was written; this list cannot tell which.

Patches

build.sh applies these; kpkg applies nothing by itself.

Installation

From the repository root, inside the build container, this is the line kdosbuild runs for the port:

script/chroot/exec.sh bash -c 'source script/phases/44_apps/phase.env && kpkg install retroarch'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/libretro/retroarch.

1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.

cd /ports/core/libretro/retroarch
echo '245ef18c8fa8fbd9fbb5eb25cf43e17c6aace2f95c1ed99873cbd794012bb232  retroarch-1.22.2.tar.gz' | sha256sum -c -

2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.

SRC_ROOT=/var/cache/kpkg/work/retroarch
SRC=$SRC_ROOT/retroarch-1.22.2
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf retroarch-1.22.2.tar.gz -C "$SRC" --strip-components=1

Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.

3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

patch -p1 -i "$PORT_SRC/config.patch"
patch -p1 -i "$PORT_SRC/database-path.patch"
patch -p1 -i "$PORT_SRC/wayland-windowed-size.patch"

export CFLAGS="${CFLAGS/-std=gnu11/}"
./configure \
	--prefix=/usr \
	--sysconfdir=/etc \
	--enable-wayland \
	--enable-libdecor \
	--enable-egl \
	--enable-opengl \
	--enable-opengl_core \
	--enable-vulkan \
	--enable-kms \
	--disable-x11 \
	--disable-qt \
	--enable-udev \
	--enable-hid \
	--enable-libusb \
	--enable-sdl2 \
	--disable-sdl \
	--enable-alsa \
	--enable-pulse \
	--enable-pipewire \
	--disable-jack \
	--disable-oss \
	--disable-rsound \
	--disable-roar \
	--disable-tinyalsa \
	--disable-audioio \
	--disable-systemd \
	--enable-freetype \
	--disable-ffmpeg \
	--disable-mpv \
	--enable-networking \
	--disable-ssl \
	--disable-online_updater \
	--disable-update_cores \
	--disable-update_core_info \
	--disable-update_assets \
	--disable-cheevos \
	--disable-discord \
	--disable-translate \
	--disable-langextra \
	--disable-builtinzlib \
	--enable-builtinflac \
	--disable-cg \
	--disable-caca \
	--disable-sixel \
	--disable-vg \
	--disable-videocore
make
make DESTDIR=$PKG install

rm -f "$PKG/usr/bin/retroarch-cg2glsl" "$PKG/usr/share/man/man6/retroarch-cg2glsl.6"

install -d "$PKG/usr/share/icons/hicolor/256x256/apps"
rsvg-convert -w 256 -h 256 media/com.libretro.RetroArch.svg \
	-o "$PKG/usr/share/icons/hicolor/256x256/apps/com.libretro.RetroArch.png"

cat > "$PKG/usr/share/applications/com.libretro.RetroArch.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=RetroArch
GenericName=Game Emulator
Comment=Play console and computer games through libretro emulator cores
TryExec=retroarch
Exec=retroarch
Icon=com.libretro.RetroArch
Terminal=false
StartupNotify=true
StartupWMClass=com.libretro.RetroArch
SingleMainWindow=true
PrefersNonDefaultGPU=true
Categories=Game;Emulator;
Keywords=retro;gaming;emulator;console;libretro;nes;snes;genesis;playstation;n64;gameboy;
DESKTOP
chmod 644 "$PKG/usr/share/applications/com.libretro.RetroArch.desktop"

The switches, and why each is set:

The common switches of each build system are explained in the Flag glossary.

4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/retroarch, prunes what the image does not ship, lints the tree and rolls it reproducibly:

tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
    --mtime=@$SOURCE_DATE_EPOCH \
    --use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
    -cf retroarch-1.22.2-2.tar.xz -C "$PKG" .

5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/retroarch, and runs the triggers its paths call for.

Contents

Installed programs: retroarch.

Installed directories: /usr/share/doc/retroarch, /usr/share/licenses/retroarch.

Short descriptions

retroarch The reference frontend for the libretro API.

Notes

The cheat directory is left at its per-user default: libretro-database installs only its rdb/ databases and cursors/, no cheat collection, so there is no system directory to point it at.

build.sh removes retroarch-cg2glsl and its manual page: it converts Nvidia Cg shaders, which this build cannot load, and it is a Python script nothing here runs.

Upstream’s install puts its SVG icon in /usr/share/pixmaps, where the entry’s Icon=com.libretro.RetroArch already resolves; the 256-pixel PNG that build.sh renders from it with rsvg-convert into the hicolor theme is a second copy the icon lookup does not need (desktop entries). Upstream’s desktop entry is replaced: it claims every ROM type, among them the Game Boy, Game Boy Color and Game Boy Advance types the mgba entry claims, which would open those files in whichever entry sorted first. RetroArch opens games from its own menu. The Wayland app id is com.libretro.RetroArch.

wayland-windowed-size.patch makes the windowed size RetroArch asks for, 960x720 by default, the size it falls back to when KWin’s configure leaves the size to the client. Without it the window returns to the 240x256 splash size and the Ozone menu is clipped. The patch is to be offered upstream.