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

330.1. goldendict-ng-26.8.0

Dictionary lookup — StarDict, DSL, MDict, ZIM, Babylon and hunspell morphology, offline

Version 26.8.0, release 1
Shelf education — Learning software, offline encyclopedias and reference dictionaries
Phase 44_apps (Applications), 86 of 422 in build order
Licence GPL-3.0-or-later
Homepage https://xiaoyifang.github.io/goldendict-ng/
Build time 7.1 SBU
Installed size 7.2 MiB in 6 files
Recipe ports/core/education/goldendict-ng/kpkgbuild

About

GoldenDict-ng looks words up in local dictionary files: StarDict, DSL, MDict, Babylon, ZIM and others, with hunspell morphology to find a word’s base form. It can also pronounce words through Qt’s speech and multimedia modules and pop up a translation for selected text. The program is called goldendict.

Sources

Dependencies

Depends on: cmake, ninja, pkgconf, qt6-qtbase, qt6-qt5compat, qt6-qttools, qt6-qtmultimedia, qt6-qtwebengine, qt6-qtsvg, qt6-qtspeech, qt6-qtwayland, hunspell, xz, lzo, opencc, tomlplusplus, libvorbis, xapian-core, zlib, bzip2, fmt, libzim, libX11, libXtst.

Required by: no port names it.

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 goldendict-ng'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/education/goldendict-ng.

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/education/goldendict-ng
echo '181534c827ca7939cb310df2013b084e4274b64f621821a4f825219f2dc888e3  goldendict-ng-26.8.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/goldendict-ng
SRC=$SRC_ROOT/goldendict-ng-26.8.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf goldendict-ng-26.8.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:

patch -p1 -i "$PORT_SRC/offline-defaults.patch"

export LDFLAGS="$LDFLAGS -Wl,-z,stack-size=8388608"
cmake -S . -B build -G Ninja \
	-D CMAKE_POLICY_VERSION_MINIMUM=3.5 \
	-D CMAKE_BUILD_TYPE=Release \
	-D CMAKE_INSTALL_PREFIX=/usr \
	-D CMAKE_SKIP_INSTALL_RPATH=ON \
	-D WITH_EPWING_SUPPORT=OFF \
	-D WITH_FFMPEG_PLAYER=OFF \
	-D WITH_QT_MULTIMEDIA=ON \
	-D WITH_ZIM=ON \
	-D WITH_TTS=ON \
	-D WITH_X11=ON \
	-D USE_ALTERNATIVE_NAME=OFF \
	-Wno-dev
cmake --build build
DESTDIR=$PKG cmake --install build

rm -rf "$PKG/usr/share/goldendict/locale"

install -Dm644 redist/icons/goldendict.png \
	"$PKG/usr/share/icons/hicolor/256x256/apps/goldendict.png"

cat > "$PKG/usr/share/applications/io.github.xiaoyifang.goldendict_ng.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=GoldenDict-ng
GenericName=Dictionary
Comment=Look words up in local dictionaries
Exec=goldendict %u
Icon=goldendict
Terminal=false
StartupWMClass=io.github.xiaoyifang.goldendict_ng
MimeType=x-scheme-handler/goldendict;x-scheme-handler/dict;
Categories=Qt;Office;Dictionary;Education;
Keywords=dict;dictionary;thesaurus;define;word;translate;stardict;
DESKTOP
chmod 644 "$PKG/usr/share/applications/io.github.xiaoyifang.goldendict_ng.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/goldendict-ng, 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 goldendict-ng-26.8.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/goldendict-ng, and runs the triggers its paths call for.

Contents

Installed programs: goldendict.

Installed directories: /usr/share/goldendict, /usr/share/licenses/goldendict-ng.

Notes

No port installs dictionary data, and with the online sources off a new profile has nothing to look a word up in. On its first start the program adds /usr/share/stardict/dic, which sdcv creates, as a recursive source, so dictionary files copied there are found at the next rescan (see GoldenDict-ng ships with no dictionary).

build.sh removes /usr/share/goldendict/locale; English is the program’s untranslated source text. Upstream’s menu entry is replaced: setDesktopFileName makes the Wayland app_id io.github.xiaoyifang.goldendict_ng, which the entry gives as StartupWMClass.