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

218.1. digital-0.31

Digital logic designer and circuit simulator for teaching, with FSM and HDL export (Java Swing)

Version 0.31, release 1
Shelf eda — Electronics: schematic and PCB, circuit simulation, antenna modelling, FPGA synthesis and simulation, logic analysers and bench instruments
Phase 42_graphics (Graphics Stack), 86 of 189 in build order
Licence GPL-3.0-only
Homepage https://github.com/hneemann/Digital
Build time 0.7 SBU
Installed size 12.0 MiB in 346 files
Recipe ports/core/eda/digital/kpkgbuild

About

Digital is a digital logic designer and circuit simulator made for teaching: gates, flip-flops, memories and whole processors drawn as circuits and simulated, with truth tables, state machines, and export to VHDL and Verilog. It is a Java Swing program; on KDOS it is an X11 client under Xwayland. The port compiles it, and the libraries it uses, from source with javac alone, without upstream’s Maven build.

Sources

Dependencies

Depends on: openjdk, unzip.

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/42_graphics/phase.env && kpkg install digital'

What kpkg does

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

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/eda/digital
echo 'c17f68c8e9cf80a13f8deb70ecb36d937c4abfec5fbc73d5d9c43b1d7f0f81ef  digital-0.31.tar.gz' | sha256sum -c -
echo '35f61c5d3f59a8b88cbcca90196ad4355666de185d1584b24e4f2a3a851ae7aa  xstream-1.4.20-sources.jar' | sha256sum -c -
echo 'b2e72350ce8b2f287c0cd435a338c17705f9047857c52a709e223af2f5cbb0de  mxparser-1.2.2-sources.jar' | sha256sum -c -
echo '2a1a71a1e413f15211225c919285516be82050e26d596e4a70bcf24d5fbae59c  xmlpull-api-v1-abeaa4aa87b2625af70c32f658f44e11355fe568.tar.gz' | sha256sum -c -
echo '6ba37c84d993aa9e284c6008bd31caf5ec7dd2a928cb6dadb529867d83cde952  slf4j-api-1.7.24-sources.jar' | sha256sum -c -
echo '4b58609f91908771dbfd5439d0664531413f65ef041b1af5b40f0902cfa97108  slf4j-simple-1.7.24-sources.jar' | sha256sum -c -
echo 'e70ce6536fc0352c6a8d398b0e534f9213938431b3ad470c0bedb50c063fbde3  json-20220924-sources.jar' | 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/digital
SRC=$SRC_ROOT/digital-0.31
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf digital-0.31.tar.gz -C "$SRC" --strip-components=1
cp xstream-1.4.20-sources.jar "$SRC"
cp mxparser-1.2.2-sources.jar "$SRC"
tar --no-same-permissions --warning=no-unknown-keyword -xf xmlpull-api-v1-abeaa4aa87b2625af70c32f658f44e11355fe568.tar.gz -C "$SRC_ROOT"
cp slf4j-api-1.7.24-sources.jar "$SRC"
cp slf4j-simple-1.7.24-sources.jar "$SRC"
cp json-20220924-sources.jar "$SRC"

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 _maven, _xstream, _mxparser, _xmlpull, _slf4j, _json and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

_dep=build/depsrc
mkdir -p "$_dep" build/classes
for _j in xstream-$_xstream mxparser-$_mxparser json-$_json slf4j-api-$_slf4j; do
	unzip -q -o "$_j-sources.jar" -d "$_dep"
done
rm -rf "$_dep/org/slf4j/impl"
unzip -q -o "slf4j-simple-$_slf4j-sources.jar" -d "$_dep"
rm -rf "$_dep/META-INF"

_opt='^import (net\.sf\.cglib|org\.dom4j|org\.jdom2?|nu\.xom|org\.kxml2|org\.xmlpull\.mxp1|org\.codehaus|org\.joda|com\.ctc|com\.bea|javax\.activation|javax\.xml\.bind)\.'
{
	find src/main/java -name '*.java'
	find "$_dep/com/thoughtworks/xstream" -name '*.java' -exec grep -LE "$_opt" {} +
} | LC_ALL=C sort > build/sources.list
javac -encoding UTF-8 -nowarn -proc:none -implicit:class \
	-d build/classes \
	-sourcepath "$_dep:$SRC_ROOT/xmlpull-api-v1-$_xmlpull/src/java/api:src/main/java" \
	@build/sources.list
cp -r src/main/resources/. build/classes/

_time=$(date -u -d "@$SOURCE_DATE_EPOCH" '+%Y-%m-%d %H:%M')
printf 'Main-Class: de.neemann.digital.gui.Main\nBuild-SCM-Revision: v%s-kdos\nBuild-Time: %s\nSplashScreen-Image: icons/splash.png\n' \
	"$version" "$_time" > build/manifest.txt
( cd build/classes && find . -type f | LC_ALL=C sort | sed 's/.*/"&"/' > ../classes.list )
( cd build/classes && jar --create --file ../Digital.jar --manifest ../manifest.txt \
	--date="$(date -u -d "@$SOURCE_DATE_EPOCH" '+%Y-%m-%dT%H:%M:%SZ')" @../classes.list )

install -Dm644 build/Digital.jar "$PKG/usr/share/digital/Digital.jar"
for _d in src/main/dig/*/; do
	install -d "$PKG/usr/share/digital/examples/$(basename "$_d")"
	cp -r "$_d". "$PKG/usr/share/digital/examples/$(basename "$_d")/"
done

install -d "$PKG/usr/bin"
cat > "$PKG/usr/bin/digital" <<'LAUNCHER'
#!/bin/sh
exec java -jar /usr/share/digital/Digital.jar "$@"
LAUNCHER
chmod 755 "$PKG/usr/bin/digital"

install -Dm644 distribution/linux/digital-simulator.xml \
	"$PKG/usr/share/mime/packages/digital-simulator.xml"
install -Dm644 src/main/resources/icons/icon128.png \
	"$PKG/usr/share/icons/hicolor/128x128/apps/digital.png"

install -d "$PKG/usr/share/applications"
cat > "$PKG/usr/share/applications/digital.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=Digital
GenericName=Logic Simulator
Comment=Design and simulate digital logic circuits
Exec=digital %f
Icon=digital
Terminal=false
StartupWMClass=de-neemann-digital-gui-Main
Categories=Education;Electronics;Engineering;
MimeType=text/x-digital;
Keywords=logic;circuit;simulator;gate;flip-flop;fsm;vhdl;verilog;
DESKTOP
chmod 644 "$PKG/usr/share/applications/digital.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/digital, 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 digital-0.31-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/digital, and runs the triggers its paths call for.

Contents

Installed programs: digital.

Installed directories: /usr/share/digital, /usr/share/licenses/digital.

Notes