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
retroarch-1.22.2.tar.gz(68.3 MiB)
sha256245ef18c8fa8fbd9fbb5eb25cf43e17c6aace2f95c1ed99873cbd794012bb232
upstream: https://github.com/libretro/RetroArch/archive/v1.22.2.tar.gz
archive copy: sources-3/libretro--retroarch-1.22.2.tar.gz
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.
--disable-x11, line 27: libX11 (explained with the switches below)--disable-ffmpeg, line 45: ffmpeg (explained with the switches below)--disable-mpv, line 46: mpv--disable-ssl, line 48: openssl--disable-sixel, line 61: libsixel
Patches
build.sh applies these; kpkg applies nothing by itself.
config.patch— Edit the skeletonretroarch.cfgthat a first run copies: hide the core updater in the menu, and point the assets, core, core information and controller autoconfiguration directories at/usr/share/libretro/assets,/usr/lib/libretro,/usr/share/libretro/infoand/usr/share/libretro/autoconfig, where the data and core ports install. Upstream’s cores, which the updater downloads, are built for glibc.database-path.patch— In the same file, point the content database directory at/usr/share/libretro/database/rdb, the libretro-database port’s.wayland-windowed-size.patch— Keep the requested windowed size as the Wayland floating sizeThe window opens at the splash size, and setting the video mode to its windowed size does not update floating_width and floating_height. The compositor's next configure carries 0x0, the configure handlers fall back to the floating size, and the window returns to 240x256 with the menu clipped.
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:
CFLAGS="${CFLAGS/-std=gnu11/}"— Remove the tree’s-std=gnu11fromCFLAGS. The configure tests each C++ standard by compiling withCFLAGSand-Werror, and g++ refuses the C-only-std=gnu11, so every C++ standard test would fail and the configure would turn C++ off; with--enable-vulkannamed, which needs C++, it then stops with an error. The project sets-std=gnu99for its C code itself.--enable-wayland— Every switch the build relies on is named, so a missing library fails the configure instead of being probed away: Wayland with--enable-libdecorfor the window decorations,--enable-egl,--enable-opengl,--enable-opengl_coreand--enable-vulkanfor the video drivers, and--enable-kmsfor running on a bare console with no compositor.--disable-x11— No X11 video or input driver: the Wayland driver draws the window, so RetroArch needs no Xwayland.--disable-qt— No Qt companion window; the menu is RetroArch’s own.--enable-udev— Gamepads through udev and evdev (eudev).--enable-hid— Build RetroArch’s low-level HID layer, off by default.--enable-libusb, the joypad driver that reads USB pads directly, is part of it, and the configure refuses libusb unless HID is enabled with it.--enable-sdl2— The SDL 2 video, input, joypad and audio drivers, through sdl2-compat;--disable-sdlleaves out SDL 1.2.--enable-alsa— Audio through ALSA,--enable-pulseand--enable-pipewire.--disable-jack— None of the other audio back ends: JACK, OSS (--disable-oss), the RSound and RoarAudio network sound servers (--disable-rsound,--disable-roar), TinyALSA (--disable-tinyalsa) and the BSDaudio(4)driver (--disable-audioio).--disable-systemd— No systemd integration (principles).--enable-freetype— Draw menu and on-screen text with freetype2.--disable-ffmpeg— No FFmpeg: its recording path and the FFmpeg media core do not build against the ffmpeg this tree carries.--disable-mpvis upstream’s default.--enable-networking— Keep netplay, which works on a local network with no TLS;--disable-sslleaves out the TLS code.--disable-online_updater— Every online service is off: the online updater and its core, core-info and asset downloads (--disable-update_cores,--disable-update_core_info,--disable-update_assets), RetroAchievements (--disable-cheevos), Discord presence (--disable-discord) and the OCR translation service (--disable-translate). Cores and data come from ports.--disable-langextra— Build no menu translations; the menu is English (language policy).--disable-builtinzlib— Link the system zlib instead of the bundled copy.--enable-builtinflac— Compile the bundled FLAC. The CHD disc-image reader decodes through the bundleddr_flac, which only this path compiles in (HAVE_DR_FLAC).--disable-cg— No Nvidia Cg shader runtime. With--disable-cacaand--disable-sixel(terminal video drivers),--disable-vg(OpenVG) and--disable-videocore(the Raspberry Pi’s Broadcom VideoCore), these drivers are left out.
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.