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

328.10. mupen64plus-2.6.0

Nintendo 64 emulator: core, console front end, SDL audio and input, HLE RSP, Rice and Glide64mk2 video

Version 2.6.0, release 3
Shelf emulators — Standalone emulators of computers and consoles, and compatibility layers
Phase 44_apps (Applications), 117 of 422 in build order
Licence GPL-2.0-or-later
Homepage https://mupen64plus.org/
Build time 1.3 SBU
Installed size 5.0 MiB in 36 files
Recipe ports/core/emulators/mupen64plus/kpkgbuild

About

Mupen64Plus is a Nintendo 64 emulator made of a core library and plugins that the core loads at run time. The port builds upstream’s source bundle, one make per component: the core, the mupen64plus console front end, the SDL audio and SDL input plugins, the high-level-emulation RSP plugin, and two video plugins, Rice and Glide64mk2. The front end has no ROM browser; it is started with a ROM file, so its desktop entry is hidden from the menu and serves only to open N64 ROM images.

Sources

Dependencies

Depends on: pkgconf, nasm, sdl2-compat, zlib, minizip, libpng, freetype2, libglvnd, mesa, glu, vulkan-loader, vulkan-headers, libsamplerate, speexdsp.

Required by: no port names it.

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

What kpkg does

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

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/mupen64plus
echo '297e17180cd76a7b8ea809d1a1be2c98ed5c7352dc716965a80deb598b21e131  mupen64plus-2.6.0.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/mupen64plus
SRC=$SRC_ROOT/mupen64plus-2.6.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf mupen64plus-2.6.0.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/fix-null-usage.patch"
export CFLAGS="${CFLAGS/-std=gnu11/}"

_mk=(
	CC="gcc -std=gnu11"
	PREFIX=/usr
	LIBDIR=/usr/lib
	PLUGINDIR=/usr/lib/mupen64plus
	SHAREDIR=/usr/share/mupen64plus
	SDL_CFLAGS="$(pkg-config --cflags sdl2)"
	SDL_LDLIBS="$(pkg-config --libs sdl2)"
	GL_CFLAGS=
	MINIZIP_CFLAGS="-I$(pkg-config --variable=includedir minizip)/minizip"
	MINIZIP_LDLIBS="$(pkg-config --libs minizip)"
	OSD=1
	VULKAN=1
	NETPLAY=0
	HIRES=1
	PIE=1
	V=1
)
_gl() { [ "$1" = video-glide64mk2 ] && echo -lGL || echo -lOpenGL; }
for _c in core ui-console audio-sdl input-sdl rsp-hle video-rice video-glide64mk2; do
	make -C "source/mupen64plus-$_c/projects/unix" all "${_mk[@]}" \
		GL_LDLIBS="$(_gl $_c)"
done
for _c in core ui-console audio-sdl input-sdl rsp-hle video-rice video-glide64mk2; do
	make -C "source/mupen64plus-$_c/projects/unix" install "${_mk[@]}" \
		GL_LDLIBS="$(_gl $_c)" LDCONFIG=true DESTDIR="$PKG"
done
for _c in core ui-console audio-sdl input-sdl rsp-hle video-rice video-glide64mk2; do
	install -Dm644 "source/mupen64plus-$_c/LICENSES" "$PKG/usr/share/licenses/$name/LICENSES.$_c"
done
for _f in core/doc/gpl-license core/doc/lgpl-license core/doc/font-license video-glide64mk2/doc/fxt1-license; do
	install -Dm644 "source/mupen64plus-$_f" "$PKG/usr/share/licenses/$name/${_f##*/}"
done

cat > "$PKG/usr/share/applications/mupen64plus.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=Mupen64Plus
GenericName=Nintendo 64 Emulator
Comment=Play a Nintendo 64 ROM image
TryExec=mupen64plus
Exec=mupen64plus %f
Icon=mupen64plus
Terminal=false
NoDisplay=true
StartupWMClass=mupen64plus
MimeType=application/x-n64-rom;
Categories=Game;Emulator;
Keywords=emulator;nintendo;n64;mupen64plus;
DESKTOP
chmod 644 "$PKG/usr/share/applications/mupen64plus.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/mupen64plus, 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 mupen64plus-2.6.0-3.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/mupen64plus, and runs the triggers its paths call for.

Contents

Installed programs: mupen64plus.

Installed libraries: libmupen64plus.so.

Installed directories: /usr/include/mupen64plus, /usr/lib/mupen64plus, /usr/share/licenses/mupen64plus, /usr/share/mupen64plus.

Short descriptions

mupen64plus console frontend for the Mupen64Plus N64 emulator

Notes

The audio plugin finds its two resamplers, libsamplerate and speexdsp, by a pkg-config probe that drops the resampler with only a warning when the library is missing. Both libraries are in depends, and that is all that keeps the src-* and speex-* resamplers in the plugin.

Upstream’s desktop entry is replaced by one written in build.sh that carries StartupWMClass=mupen64plus: the core’s SDL window takes the executable’s name as its Wayland app_id.