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

328.7. vice-3.10

Commodore 64, 128, VIC-20, PET, Plus/4 and CBM-II emulators, with their ROMs

Version 3.10, release 1
Shelf emulators — Standalone emulators of computers and consoles, and compatibility layers
Phase 44_apps (Applications), 114 of 422 in build order
Licence GPL-2.0-or-later
Homepage https://vice-emu.sourceforge.io/
Build time 12.0 SBU
Installed size 41.3 MiB in 480 files
Recipe ports/core/emulators/vice/kpkgbuild

About

VICE emulates the 8-bit Commodore machines: the C64 (x64sc), the C64 with a SuperCPU and the C64 DTV, the C128, the VIC-20, the Plus/4, the PET and the CBM-II, each as its own program, plus vsid, a player for C64 SID music files. The port uses the SDL 2 front end, drawn here by sdl2-compat on SDL 3’s Wayland driver, whose menus are drawn inside the emulated screen. The machines’ ROMs are installed with the emulators; they are one of the exemptions in What is built from source.

Sources

Dependencies

Depends on: pkgconf, perl, texinfo, xa, bison, flex, sdl2-compat, sdl2-image, libpng, giflib, zlib, alsa-lib, libpulse, flac, libvorbis, libogg, mpg123, lame, libusb.

Required by: no port names it.

Optional, off in KDOS

These switches in build.sh turn off a feature whose library is a port here. The recipe may turn each off on purpose, or because the library was not yet a port when the recipe was written; this list cannot tell which.

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

What kpkg does

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

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/vice
echo '8e5bac18cbcb9f192380ad3ef881f8790f5b75c41d7b3da65d831985d864d6d1  vice-3.10.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/vice
SRC=$SRC_ROOT/vice-3.10
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf vice-3.10.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/sdl-create-state-dir.patch"

DOS2UNIX=true ./configure --prefix=/usr --libdir=/usr/lib \
	--enable-sdl2ui \
	--with-sdlsound \
	--with-alsa \
	--with-pulse \
	--without-oss \
	--with-flac \
	--with-vorbis \
	--with-mpg123 \
	--with-lame \
	--with-png \
	--with-gif \
	--with-resid \
	--with-fastsid \
	--without-libcurl \
	--without-portaudio \
	--enable-midi \
	--disable-realdevice \
	--disable-ethernet \
	--disable-html-docs \
	--disable-pdf-docs
_mkflags=(CFLAGS="${CFLAGS/-O2/-O3} -g0" CXXFLAGS="${CXXFLAGS/-O2/-O3} -g0")
make "${_mkflags[@]}"
make "${_mkflags[@]}" DESTDIR=$PKG install

for _size in 16 24 32 48 64 256; do
	_dir="$PKG/usr/share/icons/hicolor/${_size}x${_size}/apps"
	install -d "$_dir"
	for _emu in vsid x64 x64dtv x128 xcbm2 xpet xplus4 xscpu64 xvic; do
		install -m644 "data/common/vice-${_emu}_${_size}.png" "$_dir/vice-${_emu}.png"
	done
done

_entry() {
	cat > "$PKG/usr/share/applications/vice-$1.desktop" <<DESKTOP
[Desktop Entry]
Type=Application
Name=$3
GenericName=$4
Comment=$5
TryExec=$1
Exec=$1 %f
Icon=vice-$2
Terminal=false
StartupWMClass=$1
Categories=Game;Emulator;
Keywords=vice;commodore;cbm;emulator;retro;$6
DESKTOP
	chmod 644 "$PKG/usr/share/applications/vice-$1.desktop"
}
install -d "$PKG/usr/share/applications"
_entry x64sc   x64     'VICE C64'           'Commodore 64 Emulator'    'Emulate the Commodore 64'                          'c64;commodore 64;'
_entry xscpu64 xscpu64 'VICE C64 SuperCPU'  'Commodore 64 Emulator'    'Emulate the Commodore 64 with a SuperCPU'          'c64;supercpu;'
_entry x64dtv  x64dtv  'VICE C64 DTV'       'Commodore 64 Emulator'    'Emulate the C64 Direct-to-TV joystick'             'c64;dtv;'
_entry x128    x128    'VICE C128'          'Commodore 128 Emulator'   'Emulate the Commodore 128'                         'c128;commodore 128;'
_entry xvic    xvic    'VICE VIC-20'        'VIC-20 Emulator'          'Emulate the Commodore VIC-20'                      'vic20;vic-20;'
_entry xplus4  xplus4  'VICE Plus/4'        'Plus/4 Emulator'          'Emulate the Commodore Plus/4, C16 and C116'        'plus4;c16;ted;'
_entry xpet    xpet    'VICE PET'           'PET Emulator'             'Emulate the Commodore PET and SuperPET'            'pet;superpet;'
_entry xcbm2   xcbm2   'VICE CBM-II'        'CBM-II Emulator'          'Emulate the CBM-II 600 and 700 series'             'cbm2;b128;'
_entry xcbm5x0 xcbm2   'VICE CBM 5x0'       'CBM-II Emulator'          'Emulate the CBM-II 500 series (P500)'              'cbm2;p500;'
_entry vsid    vsid    'VICE SID Player'    'SID Music Player'         'Play Commodore 64 SID music files'                 'sid;music;chiptune;'

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/vice, 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 vice-3.10-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/vice, and runs the triggers its paths call for.

Contents

Installed programs: c1541, cartconv, petcat, vsid, x128, x64, x64dtv, x64sc, xcbm2, xcbm5x0, xpet, xplus4, xscpu64, xvic.

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

Notes

The SDL front end writes its log to vice.log in ~/.local/state/vice and does not survive failing to open it, so an emulator started on an account without that directory crashes before its window. sdl-create-state-dir.patch makes the SDL front end create the directory at start-up beside the cache and configuration directories, as the GTK 3 front end does.

configure refuses any --enable- or --with- switch it does not list itself, so the usual --disable-static is not passed.

The SDL front end installs no icons or menu entries. build.sh installs the PNG icons from data/common and writes one entry per machine; x64sc and xcbm5x0 have no icon of their own and share their family’s. Each emulator is its own program, and SDL’s Wayland app_id is the executable’s name.