329.3. libretro-mupen64plus-next-20260912
Mupen64Plus-Next as a libretro core — Nintendo 64 emulator with the GLideN64 renderer
| Version | 20260912, release 2 |
| Shelf | libretro — RetroArch, its assets, databases and libretro cores |
| Phase | 44_apps (Applications), 273 of 422 in build order |
| Licence | GPL-2.0-or-later AND GPL-2.0-only |
| Homepage | https://github.com/libretro/mupen64plus-libretro-nx |
| Build time | 5.0 SBU |
| Installed size | 4.3 MiB in 2 files |
| Recipe | ports/core/libretro/libretro-mupen64plus-next/kpkgbuild |
About
Mupen64Plus-Next is a Nintendo 64 emulator packaged as a libretro core: a shared object, mupen64plus_next_libretro.so, that retroarch loads from /usr/lib/libretro. It joins the Mupen64Plus core to the GLideN64 renderer, which draws through desktop OpenGL from mesa by way of libglvnd.
Sources
libretro-mupen64plus-next-20260912.tar.gz(14.3 MiB)
sha25678509e9787729aa0051915e646200ce21ab2d7e809318c9b1dfdaabcab2f067d
upstream: https://github.com/libretro/mupen64plus-libretro-nx/archive/6752836de8b224febfd5708444755b77712ac939.tar.gz
archive copy: sources-3/libretro--libretro-mupen64plus-next-20260912.tar.gz
Dependencies
Depends on: nasm, pkgconf, mesa, libglvnd, zlib, libpng, minizip, xxhash.
Required by: no port names it.
Patches
build.sh applies these; kpkg applies nothing by itself.
gcc14.patch— minizip: avoid trying to compile problematic codeTrying to compile this libretro core on my Fedora aarch64 machine I was getting this error:
mupen64plus-core/subprojects/minizip/zip.c:1249:28: error: assignment to ‘const long unsigned int *’ from incompatible pointer type ‘const uint32_t *’ {aka ‘const unsigned int *’} [-Wincompatible-pointer-types] 1249 | zi->ci.pcrc_32_tab = get_crc_table(); | ^ (redacted for clarity in this commit message)
Curiously, mupen64plus-core having the same minizip code didn't suffer from this error. This is because there the problematic code has been disabled by using exclusion defines NOCRYPT and NOUNCRYPT.
This commit tries to do the same for this repository.
gcc15.patch— adds#include <cstdint>at the top ofGLideN64/src/GLideNHQ/TxHiResLoader.h, ahead of its include guard, for theuint32_tanduint8_tin its declarations. The header in this snapshot already includes<cstdint>after the guard, so the added line repeats an include the compiler has seen.
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 libretro-mupen64plus-next'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/libretro/libretro-mupen64plus-next.
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/libretro-mupen64plus-next
echo '78509e9787729aa0051915e646200ce21ab2d7e809318c9b1dfdaabcab2f067d libretro-mupen64plus-next-20260912.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/libretro-mupen64plus-next
SRC=$SRC_ROOT/libretro-mupen64plus-next-20260912
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf libretro-mupen64plus-next-20260912.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 _commit and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
patch -p1 -i "$PORT_SRC/gcc14.patch"
patch -p1 -i "$PORT_SRC/gcc15.patch"
export CFLAGS="$CFLAGS -I$(pkg-config --variable=includedir minizip)/minizip"
make platform=unix WITH_DYNAREC=x86_64 \
SYSTEM_ZLIB=1 SYSTEM_LIBPNG=1 SYSTEM_MINIZIP=1 SYSTEM_XXHASH=1
install -Dm755 mupen64plus_next_libretro.so "$PKG/usr/lib/libretro/mupen64plus_next_libretro.so"
install -Dm644 LICENSE "$PKG/usr/share/licenses/$name/LICENSE"
The switches, and why each is set:
platform=unix— the Linux branch of upstream’sMakefile: it names the targetmupen64plus_next_libretro.so, links it with-sharedand the core’s version script, links desktop GL (-lGL), and assembles withnasm -f elf64on x86-64.WITH_DYNAREC=x86_64— compile the dynamic recompiler for x86-64 (NEW_DYNAREC=2), which translates the console’s MIPS code to host code, with its assembly linkage file built by nasm. Upstream derives the value fromuname -m; naming it keeps the recompiler in the build whatever the build host reports.SYSTEM_ZLIB=1— withSYSTEM_LIBPNG=1,SYSTEM_MINIZIP=1andSYSTEM_XXHASH=1, link the tree’s zlib, libpng, minizip and xxhash throughpkg-configinstead of the copies the source carries: libpng and zlib undercustom/dependencies/, minizip undermupen64plus-core/subprojects/minizip/, and the xxHash headers underxxHash/. Each upstream default is0.
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/libretro-mupen64plus-next, 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 libretro-mupen64plus-next-20260912-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/libretro-mupen64plus-next, and runs the triggers its paths call for.
Contents
Installed directories: /usr/share/licenses/libretro-mupen64plus-next.
Notes
The CFLAGS line adds the minizip/ include directory by hand. The save-state code (mupen64plus-core/src/main/savestates.c) includes <unzip.h> and <zip.h> by bare name, while the minizip port’s minizip.pc gives only -I/usr/include, the directory above minizip/. The makefile appends its own flags to the exported CFLAGS, so the directory reaches every compile.
gcc14.patch carries three upstream commits, each with its own description. Of them, only the EmuThread change touches this build: the other two add defines to the branches of Makefile.common that compile the bundled minizip and zlib, which SYSTEM_MINIZIP=1 and SYSTEM_ZLIB=1 leave unused.