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

328.13. openmsx-21.0

MSX home computer emulator with C-BIOS, a built-in debugger and GUI

Version 21.0, release 2
Shelf emulators — Standalone emulators of computers and consoles, and compatibility layers
Phase 44_apps (Applications), 120 of 422 in build order
Licence GPL-2.0-or-later
Homepage https://openmsx.org/
Build time 6.3 SBU
Installed size 17.5 MiB in 743 files
Recipe ports/core/emulators/openmsx/kpkgbuild

About

openMSX is an emulator of the MSX family of home computers, MSX1 to the turbo R, with a built-in debugger and an ImGui interface, scripted in Tcl. The package installs C-BIOS, the free MSX system ROMs from upstream’s Contrib/, so the emulator starts with no copyrighted ROM.

Sources

Dependencies

Depends on: python3, pkgconf, sdl2-compat, sdl2-ttf, freetype2, libpng, zlib, tcl, glew, libglvnd, mesa, libogg, libvorbis, libtheora, alsa-lib.

Required by: no port names it.

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

What kpkg does

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

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

install -d "$SRC_ROOT/sdl-shim"
cat > "$SRC_ROOT/sdl-shim/sdl2-config" <<'SHIM'
#!/bin/sh
case "$1" in
--cflags) exec pkg-config --cflags sdl2 ;;
--libs) exec pkg-config --libs sdl2 ;;
--version) exec pkg-config --modversion sdl2 ;;
*) exit 1 ;;
esac
SHIM
chmod 755 "$SRC_ROOT/sdl-shim/sdl2-config"
export PATH="$SRC_ROOT/sdl-shim:$PATH"

_dirs=(
	INSTALL_BINARY_DIR=/usr/bin
	INSTALL_SHARE_DIR=/usr/share/openmsx
	INSTALL_DOC_DIR=/usr/share/doc/openmsx
	INSTALL_CONTRIB=true
	SYMLINK_FOR_BINARY=false
	OPENMSX_FLAVOUR=opt
	3RDPARTY_FLAG=false
	CXXFLAGS="${CXXFLAGS/-O2/-O3} -DNDEBUG"
	LDFLAGS="${LDFLAGS//-Wl,/}"
)
./configure
make "${_dirs[@]}"
make install "${_dirs[@]}" DESTDIR="$PKG" INSTALL_VERBOSE=false

install -Dm644 doc/GPL.txt "$PKG/usr/share/licenses/$name/GPL.txt"

for _size in 16 32 48 64 128 256; do
	install -Dm644 "share/icons/openMSX-logo-$_size.png" \
		"$PKG/usr/share/icons/hicolor/${_size}x${_size}/apps/openmsx.png"
done

install -d "$PKG/usr/share/applications"
cat > "$PKG/usr/share/applications/openmsx.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=openMSX
GenericName=MSX Emulator
Comment=Emulate the MSX family of home computers
TryExec=openmsx
Exec=openmsx %f
Icon=openmsx
Terminal=false
StartupWMClass=openmsx
Categories=Game;Emulator;
Keywords=msx;msx2;turbo r;emulator;retro;cbios;
DESKTOP
chmod 644 "$PKG/usr/share/applications/openmsx.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/openmsx, 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 openmsx-21.0-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/openmsx, and runs the triggers its paths call for.

Contents

Installed programs: openmsx.

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

Notes

openMSX’s probe asks sdl2-config for SDL’s flags and has no other route, and the tree has no sdl2-config (sdl2-compat removes it). build.sh writes a shim of that name into $SRC_ROOT/sdl-shim, first on PATH, that answers --cflags, --libs and --version from pkg-config, which reads sdl2-compat’s Provides: sdl2. The shim is never installed.

Beyond the emulation core, the probe builds every component whose libraries it finds: the OpenGL renderer through glew, LaserDisc video through libogg, libvorbis and libtheora, and ALSA MIDI through alsa-lib. Each of those libraries is in depends, which is all that keeps a component from being left out with no error.

Upstream ships no desktop entry and installs its icons only under its share directory; build.sh writes the entry, with StartupWMClass=openmsx because SDL’s Wayland app_id is the executable’s name, and installs the logo in six sizes into the hicolor theme.