330.2. kiwix-desktop-2.5.1
Offline reader for ZIM libraries such as Wikipedia, with search, tabs and a reading list
| Version | 2.5.1, release 1 |
| Shelf | education — Learning software, offline encyclopedias and reference dictionaries |
| Phase | 44_apps (Applications), 87 of 422 in build order |
| Licence | GPL-3.0-or-later |
| Homepage | https://kiwix.org/ |
| Build time | 1.7 SBU |
| Installed size | 1.8 MiB in 13 files |
| Recipe | ports/core/education/kiwix-desktop/kpkgbuild |
About
Kiwix Desktop reads ZIM archives, the offline copies of Wikipedia, Wiktionary, Stack Exchange and other sites, with full-text search, tabs and a reading list. It is a Qt 6 program that renders the pages through QtWebEngine and reads the archives through libkiwix and libzim.
Sources
kiwix-desktop-2.5.1.tar.gz(669.9 KiB)
sha25630936feca234addcf7dbc58961750a0efe87023284a4a2f0fe36adeb44daaf91
upstream: https://github.com/kiwix/kiwix-desktop/archive/refs/tags/2.5.1.tar.gz
archive copy: sources-2/education--kiwix-desktop-2.5.1.tar.gz
Dependencies
Depends on: qt6-qtbase, qt6-qtwayland, qt6-qtwebengine, qt6-qtwebchannel, qt6-qtsvg, qt6-qtimageformats, qt6-qtspeech, libkiwix, libzim, aria2, pkgconf, hicolor-icon-theme, shared-mime-info.
Required by: no port names it.
Patches
build.sh applies these; kpkg applies nothing by itself.
app-id.patch— Set the desktop file name before the first window is createdThe content manager can open an error dialog while it is constructed, before init() set the desktop file name, so that dialog took the executable's name as its Wayland app id. Set org.kiwix.desktop first in init().
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 kiwix-desktop'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/education/kiwix-desktop.
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/kiwix-desktop
echo '30936feca234addcf7dbc58961750a0efe87023284a4a2f0fe36adeb44daaf91 kiwix-desktop-2.5.1.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/kiwix-desktop
SRC=$SRC_ROOT/kiwix-desktop-2.5.1
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf kiwix-desktop-2.5.1.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/app-id.patch"
mkdir -p build && cd build
qmake6 .. \
PREFIX=/usr \
CONFIG+=release \
QMAKE_CFLAGS+="$CFLAGS" \
QMAKE_CXXFLAGS+="$CXXFLAGS" \
QMAKE_LFLAGS+="$LDFLAGS" \
-after QMAKE_CXXFLAGS+=-Wno-error
make
make INSTALL_ROOT="$PKG" install
[ -f "$PKG/usr/share/icons/hicolor/48x48/apps/kiwix-desktop.png" ] ||
{ echo "kiwix-desktop: the hicolor PNG icon was not installed" >&2; exit 1; }
cat > "$PKG/usr/share/applications/org.kiwix.desktop.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=Kiwix
GenericName=Offline Library
Comment=Read ZIM archives such as Wikipedia with no network
Exec=kiwix-desktop %F
Icon=kiwix-desktop
Terminal=false
StartupWMClass=org.kiwix.desktop
MimeType=application/org.kiwix.desktop.x-zim;
Categories=Qt;Education;
Keywords=zim;wikipedia;offline;encyclopedia;library;kiwix;
DESKTOP
chmod 644 "$PKG/usr/share/applications/org.kiwix.desktop.desktop"
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/kiwix-desktop, 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 kiwix-desktop-2.5.1-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/kiwix-desktop, and runs the triggers its paths call for.
Contents
Installed programs: kiwix-desktop.
Installed directories: /usr/share/licenses/kiwix-desktop.
Notes
Downloads from the online catalogue go through aria2: at every start the download manager has libkiwix launch aria2c with its JSON-RPC interface enabled and drives it over that. Without aria2c on PATH, Kiwix opens a “Cannot create downloader” error at every start and offers no downloads, so aria2 is in depends.
app-id.patch sets the desktop file name, which Qt gives every window as its Wayland app id, first in KiwixApp::init(). Upstream sets it after constructing the content manager, which can open an error dialog of its own, and that dialog then takes the executable’s name, kiwix-desktop, which no entry is named after. The patch is to be offered upstream.
build.sh writes the desktop entry, org.kiwix.desktop.desktop: KWin finds a Wayland window’s icon only in the entry whose file name is the window’s app id, org.kiwix.desktop, which is also the name the metainfo’s launchable and /usr/share/kdos/xdg/kde-mimeapps.list use.