328.5. dosbox-staging-0.83.0
DOS PC emulator for games and old software
| Version | 0.83.0, release 1 |
| Shelf | emulators — Standalone emulators of computers and consoles, and compatibility layers |
| Phase | 44_apps (Applications), 112 of 422 in build order |
| Licence | GPL-2.0-or-later |
| Homepage | https://www.dosbox-staging.org |
| Build time | 6.6 SBU |
| Installed size | 34.9 MiB in 412 files |
| Recipe | ports/core/emulators/dosbox-staging/kpkgbuild |
About
DOSBox Staging emulates an IBM PC compatible running DOS, with its sound cards and graphics adapters, to play DOS games and run old DOS software. It is an SDL 2 program, drawn here by sdl2-compat on SDL 3. MT-32 music comes from libmt32emu and General MIDI from fluidsynth; both need data the player supplies, the Roland ROMs and a SoundFont.
Sources
dosbox-staging-0.83.0.tar.gz(9.1 MiB)
sha2569b36be5a666784adaeffa560bd0950691f851a76bdb97e7ae3c989561e91caf3
upstream: https://github.com/dosbox-staging/dosbox-staging/archive/refs/tags/v0.83.0.tar.gz
archive copy: sources-2/emulators--dosbox-staging-0.83.0.tar.gz
Dependencies
Depends on: cmake, ninja, pkgconf, sdl2-compat, sdl2-image, iir1, libpng, mesa, libglvnd, libmt32emu, fluidsynth, alsa-lib, speexdsp, zlib-ng, opusfile, libslirp.
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 dosbox-staging'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/emulators/dosbox-staging.
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/dosbox-staging
echo '9b36be5a666784adaeffa560bd0950691f851a76bdb97e7ae3c989561e91caf3 dosbox-staging-0.83.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/dosbox-staging
SRC=$SRC_ROOT/dosbox-staging-0.83.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf dosbox-staging-0.83.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:
cmake -B build -G Ninja \
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_SKIP_RPATH=ON \
-DHAVE_PTHREAD_SETNAME_NP=1 \
-DCMAKE_DISABLE_FIND_PACKAGE_Git=ON \
-DIS_PRESET_USED=TRUE \
-DUSE_SYSTEM_LIBS=ON \
-DOPT_TESTS=OFF \
-DOPT_DOCUMENTATION=OFF \
-DOPT_DEBUGGER=OFF \
-DOPT_OPENGL=ON \
-DOPT_MT32EMU=ON \
-DOPT_MANYMOUSE=ON \
-DOPT_XINPUT=OFF
ninja -C build
DESTDIR=$PKG ninja -C build install
rm -rf "$PKG/usr/share/dosbox-staging/resources/translations"
mv "$PKG"/usr/share/dosbox-staging/resources/* "$PKG/usr/share/dosbox-staging/"
rmdir "$PKG/usr/share/dosbox-staging/resources"
cat > "$PKG/usr/share/applications/org.dosbox_staging.dosbox_staging.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=DOSBox Staging
GenericName=DOS Emulator
Comment=Run DOS games and programs on an emulated PC
TryExec=dosbox
Exec=dosbox
Icon=org.dosbox_staging.dosbox_staging
Terminal=false
StartupWMClass=org.dosbox_staging.dosbox_staging
Categories=Game;Emulator;
Keywords=dos;msdos;freedos;pc;game;emulator;dosbox;
DESKTOP
chmod 644 "$PKG/usr/share/applications/org.dosbox_staging.dosbox_staging.desktop"
The switches, and why each is set:
-DCMAKE_SKIP_RPATH=ON— Write no run path. Upstream sets$ORIGIN/lib, alib/directory beside the binary for its bundled vcpkg libraries, which a system install does not have.-DHAVE_PTHREAD_SETNAME_NP=1— Answer configure’s check forpthread_setname_npin advance. musl declares it inpthread.honly under_GNU_SOURCE, which the check does not define, so the check fails although the function is there, and the emulator’s threads would go unnamed.-DCMAKE_DISABLE_FIND_PACKAGE_Git=ON— Do not look for git. With git found, configure runsgit rev-parsein the source directory, which is no checkout; without it the build hash reads?.-DIS_PRESET_USED=TRUE— Upstream builds only through its CMake presets and warns when none is used; every preset sets this variable, and setting it here silences the warning.-DUSE_SYSTEM_LIBS=ON— Find opusfile through pkg-config, as upstream’s Linux presets do, instead of as theOpusFileCMake package vcpkg writes. It is the variable’s only effect; every other library is found the same way either way.-DOPT_TESTS=OFF— No GTest suite, which upstream builds by default.-DOPT_DOCUMENTATION=OFF— No offline MkDocs manual. It is upstream’s default.-DOPT_DEBUGGER=OFF— No built-in DOS debugger. It is upstream’s default.-DOPT_OPENGL=ON— The OpenGL renderer, upstream’s default.-DOPT_MT32EMU=ON— Roland MT-32 emulation through libmt32emu, upstream’s default.-DOPT_MANYMOUSE=ON— ManyMouse, which reads several mice separately for the two-player modes of The Settlers I and II. It is upstream’s default.-DOPT_XINPUT=OFF— ManyMouse reads the mice through evdev, not through the X Input protocol. It is upstream’s default.
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/dosbox-staging, 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 dosbox-staging-0.83.0-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/dosbox-staging, and runs the triggers its paths call for.
Contents
Installed programs: dosbox.
Installed directories: /usr/share/doc/dosbox-staging, /usr/share/dosbox-staging, /usr/share/licenses/dosbox-staging.
Short descriptions
dosbox |
DOSBox Staging, x86/DOS emulator, a modern continuation of DOSBox |
Notes
libslirp, for the emulated network card, is loaded at run time.
Upstream installs its resources, the shaders, mapper files, FreeDOS code pages and the rest, into /usr/share/dosbox-staging/resources/, one level below the /usr/share/dosbox-staging its resource search looks in, and the search finds no shaders there and aborts the emulator at start. No configure variable moves one without the other, so build.sh moves the tree up a level after the install. Before that it removes the translations directory; the interface falls back to its built-in English messages. Upstream’s menu entry is replaced by an English one with a TryExec and a StartupWMClass. The Wayland app_id is org.dosbox_staging.dosbox_staging, set through SDL’s app-id hint, and the icon of that name is upstream’s hicolor set, a scalable SVG and PNGs from 16 to 1024 pixels.