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
openmsx-21.0.tar.gz(5.8 MiB)
sha25628838bfa974a0b769b04a8820ad7953a7ad0835eb5d1764db173deac75984b6f
upstream: https://github.com/openMSX/openMSX/releases/download/RELEASE_21_0/openmsx-21.0.tar.gz
archive copy: sources-2/emulators--openmsx-21.0.tar.gz
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:
INSTALL_BINARY_DIR=/usr/bin— WithINSTALL_SHARE_DIR=/usr/share/openmsxandINSTALL_DOC_DIR=/usr/share/doc/openmsx: the install directories. Upstream installs everything into one self-contained directory,/opt/openMSX. The share directory is compiled into the binary, which reads its machines, extensions and scripts from there, so the same values go tomakeand tomake install.INSTALL_CONTRIB=true— InstallsContrib/, which is C-BIOS. Upstream’s default, named.SYMLINK_FOR_BINARY=false— Changes nothing in this build.build/install.pyreads this setting frombuild/custom.mk, never from themakeline, and it makes its link to the binary (in/usr/local/binor~/bin) only for an install with noDESTDIR.OPENMSX_FLAVOUR=opt— The generic optimised build, which targets no particular CPU, and whose link line strips the binary with-s. Upstream’s default on x86-64, named.3RDPARTY_FLAG=false— Links the system libraries dynamically.truelinks the static copies that upstream’smake 3rdpartydownloads and compiles, its route for binary packages.CXXFLAGS="${CXXFLAGS/-O2/-O3} -DNDEBUG"— The makefile startsCXXFLAGSempty and never reads the environment, so the tree’s flags go on themakeline. There they replace everyCXXFLAGS +=in the makefile, the opt flavour’s-O3 -DNDEBUG -fomit-frame-pointeramong them, so this value carries the first two back. GCC omits the frame pointer at-O3on x86-64 without the third.LDFLAGS="${LDFLAGS//-Wl,/}"— The makefile also startsLDFLAGSempty, and treats it as a list of linker arguments, putting-Wl,before each word. The tree’s flags are passed without their own-Wl,prefix, so each comes out as one-Wl,argument.INSTALL_VERBOSE=false— The install prints neither its opening line nor the closing notice about where to put MSX system ROMs.
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.