302.4. nheko-0.12.1
Matrix chat client (Qt 6) — rooms, end-to-end encryption, voice and video calls
| Version | 0.12.1, release 1 |
| Shelf | chat — Instant messaging, IRC, XMPP, Matrix, fediverse and voice clients, with their protocol and E2E libraries |
| Phase | 44_apps (Applications), 31 of 422 in build order |
| Licence | GPL-3.0-or-later |
| Homepage | https://nheko-reborn.github.io/ |
| Build time | 10.6 SBU |
| Installed size | 25.1 MiB in 14 files |
| Recipe | ports/core/chat/nheko/kpkgbuild |
About
Nheko is a desktop client for Matrix, written in C++ with a Qt 6 Quick interface: rooms and direct chats, end-to-end encryption with device verification, and voice and video calls. The Matrix protocol itself is mtxclient, the library from the same project, and the encryption is olm.
Sources
nheko-0.12.1.tar.gz(2.0 MiB)
sha25681cc613ee2420b1289c9cc7aeee81cae69a153971fd3112225e48d1c7b224ea5
upstream: https://github.com/Nheko-Reborn/nheko/archive/refs/tags/v0.12.1.tar.gz
archive copy: sources-1/chat--nheko-0.12.1.tar.gz
Dependencies
Depends on: cmake, ninja, pkgconf, asciidoctor, qt6-qtbase, qt6-qtdeclarative, qt6-qtmultimedia, qt6-qtsvg, qt6-qttools, qt6-qtimageformats, qt6-qtwayland, qtkeychain, kdsingleapplication, mtxclient, coeurl, olm, spdlog, fmt, lmdb, lmdbxx, cmark, nlohmann-json, re2, openssl, libevent, curl, zlib, gstreamer, gst-plugins-base, gst-plugins-good, gst-plugins-bad, libnice, hicolor-icon-theme.
Required by: no port names it.
Patches
build.sh applies these; kpkg applies nothing by itself.
fix-reply.patch— Fix most reply rendering issues with qt 6.9.2qt6.10-private-modules.patch— Search for private modules with Qt 6.10Usage of private Qt modules requires a call to
`find_package(Qt6 COMPONENTS FooPrivate)` since 6.10 [1].
The build complains about
'CMake Error at CMakeLists.txt:909 (target_link_libraries): Target "nheko" links to:
Qt::QmlPrivate
but the target was not found.'
otherwise.
[1] https://doc-snapshots.qt.io/qt6-dev/whatsnew610.html#build-system-changes
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 nheko'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/chat/nheko.
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/chat/nheko
echo '81cc613ee2420b1289c9cc7aeee81cae69a153971fd3112225e48d1c7b224ea5 nheko-0.12.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/nheko
SRC=$SRC_ROOT/nheko-0.12.1
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf nheko-0.12.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/qt6.10-private-modules.patch"
patch -p1 -i "$PORT_SRC/fix-reply.patch"
export LDFLAGS="$LDFLAGS -Wl,-z,stack-size=1048576"
cmake -S . -B build -G Ninja \
-D CMAKE_INSTALL_PREFIX=/usr \
-D CMAKE_INSTALL_LIBDIR=lib \
-D CMAKE_BUILD_TYPE=Release \
-D CMAKE_SKIP_RPATH=ON \
-D HUNTER_ENABLED=OFF \
-D USE_BUNDLED_CPPHTTPLIB=ON \
-D USE_BUNDLED_BLURHASH=ON \
-D VOIP=ON \
-D SCREENSHARE_XDP=ON \
-D X11=OFF \
-D MAN=ON \
-D CI_BUILD=OFF \
-Wno-dev
cmake --build build
DESTDIR=$PKG cmake --install build
The switches, and why each is set:
-Wl,-z,stack-size=1048576, added toLDFLAGS— ask for a 1 MiB stack in the program’sPT_GNU_STACKheader. musl gives each new thread 128 KiB of stack unless that header asks for more, and nheko’s worker threads need more than that.-D CMAKE_SKIP_RPATH=ON— write no RPATH into the program.-D HUNTER_ENABLED=OFF— do not use Hunter, the CMake package manager upstream can fetch every dependency with. It is upstream’s default, and mostUSE_BUNDLED_…switches take their default from it, so with it off spdlog, fmt, olm, cmark, nlohmann-json, mtxclient, lmdb, lmdbxx, qtkeychain, coeurl, libevent, curl, re2 and KDSingleApplication all come from their ports.-D USE_BUNDLED_CPPHTTPLIB=ON— compile the copy of cpp-httplib underthird_party/, and with-D USE_BUNDLED_BLURHASH=ONthe one of blurhash. Both are upstream’s defaults, and neither library is a port.-D VOIP=ON— voice and video calls through GStreamer’s WebRTC library (gstreamer-webrtc-1.0), upstream’s default on Linux, named.-D SCREENSHARE_XDP=ON— share the screen in a call through the desktop’s ScreenCast portal. It is upstream’s default whenVOIPis on.-D X11=OFF— leave out the X11-only code: screen sharing by grabbing X11 windows and setting X11 window roles. Upstream gives the switch an empty default, which CMake reads as off.-D MAN=ON— build the manual page from its AsciiDoc source with asciidoctor, upstream’s default on Linux.-D CI_BUILD=OFF— upstream’s switch for its own CI, which adds-Werror; off by 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/nheko, 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 nheko-0.12.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/nheko, and runs the triggers its paths call for.
Contents
Installed programs: nheko.
Installed directories: /usr/share/licenses/nheko.
Short descriptions
nheko |
Desktop client for Matrix using Qt and C++17 |
Notes
Both patches are upstream commits and carry their own descriptions. One makes the CMake build find the private Qt modules nheko links, which Qt from 6.10 on has to be asked for by name (GuiPrivate, QmlPrivate); the other repairs how replies are drawn in the timeline from Qt 6.9.2 on.