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

328.3. mgba-0.10.5

Game Boy Advance, Game Boy and Game Boy Color emulator, SDL front end

Version 0.10.5, release 1
Shelf emulators — Standalone emulators of computers and consoles, and compatibility layers
Phase 44_apps (Applications), 110 of 422 in build order
Licence MPL-2.0
Homepage https://mgba.io
Build time 2.6 SBU
Installed size 3.0 MiB in 176 files
Recipe ports/core/emulators/mgba/kpkgbuild

About

mGBA emulates the Game Boy Advance, Game Boy and Game Boy Color. This port builds libmgba and the SDL front end, mgba, which runs one ROM named on its command line; the libretro core is the libretro-mgba port, built from the same tarball, and RetroArch is the menu’s emulator front end. The player supplies the ROMs; the replacement GBA BIOS that mGBA compiles in is one of the exemptions listed in What is built from source.

Sources

Dependencies

Depends on: cmake, ninja, pkgconf, sdl2-compat, libepoxy, mesa, libglvnd, libpng, zlib, libzip, sqlite, elfutils, libedit.

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.

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 mgba'

What kpkg does

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

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/emulators/mgba
echo '91d6fbd32abcbdf030d58d3f562de25ebbc9d56040d513ff8e5c19bee9dacf14  mgba-0.10.5.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/mgba
SRC=$SRC_ROOT/mgba-0.10.5
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf mgba-0.10.5.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 recipe’s helpers group and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

cmake -B build -G Ninja \
	-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
	-DCMAKE_BUILD_TYPE=Release \
	-DCMAKE_INSTALL_PREFIX=/usr \
	-DBUILD_SHARED=ON \
	-DBUILD_STATIC=OFF \
	-DBUILD_SDL=ON \
	-DBUILD_QT=OFF \
	-DBUILD_LIBRETRO=OFF \
	-DBUILD_TEST=OFF \
	-DBUILD_SUITE=OFF \
	-DBUILD_GL=ON \
	-DBUILD_GLES2=ON \
	-DBUILD_GLES3=ON \
	-DUSE_EPOXY=ON \
	-DUSE_FFMPEG=OFF \
	-DUSE_LUA=OFF \
	-DENABLE_SCRIPTING=OFF \
	-DUSE_DISCORD_RPC=OFF \
	-DUSE_ZLIB=ON \
	-DUSE_PNG=ON \
	-DUSE_LIBZIP=ON \
	-DUSE_MINIZIP=OFF \
	-DUSE_LZMA=ON \
	-DUSE_SQLITE3=ON \
	-DUSE_ELF=ON \
	-DUSE_EDITLINE=ON \
	-DUSE_GDB_STUB=ON \
	-DSDL_VERSION=2
ninja -C build
DESTDIR=$PKG ninja -C build install

install -d "$PKG/usr/share/applications"
cat > "$PKG/usr/share/applications/mgba.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=mGBA
GenericName=Game Boy Advance Emulator
Comment=Play Game Boy Advance, Game Boy and Game Boy Color games
TryExec=mgba
Exec=mgba %f
Icon=io.mgba.mGBA
Terminal=false
NoDisplay=true
StartupWMClass=mgba
Categories=Game;Emulator;
MimeType=application/x-gba-rom;application/x-gameboy-rom;application/x-gameboy-color-rom;
Keywords=emulator;gba;gbc;gb;game boy;advance;mgba;
DESKTOP
chmod 644 "$PKG/usr/share/applications/mgba.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/mgba, 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 mgba-0.10.5-1.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/mgba, and runs the triggers its paths call for.

Contents

Installed programs: mgba.

Installed libraries: libmgba.so.

Installed directories: /usr/include/mgba, /usr/include/mgba-util, /usr/share/doc/mGBA, /usr/share/licenses/mgba.

Short descriptions

mgba Game Boy Advance emulator

Notes

The SDL front end needs a ROM on its command line, so its entry has NoDisplay=true and is an open-with handler for the three ROM types rather than a menu row. SDL names the Wayland window after the executable, mgba. The icon is upstream’s, installed as io.mgba.mGBA.

group = mgba keeps this port and libretro-mgba one version bump: both build the same tarball (see Steering the checker from a recipe).