240.1. libktorrent-26.08.2
BitTorrent protocol library behind KTorrent: DHT, uTP, encryption, magnet links and UPnP
26.08.2-1 · GPL-2.0-or-later AND BSD-3-Clause AND MIT AND CC0-1.0 · 2.2 SBU · 3.1 MiB, 195 files · 43_toolkits, 330 of 344 · ports/core/transfer/libktorrent
Homepage: https://invent.kde.org/network/libktorrent
LibKTorrent is the BitTorrent engine of ktorrent: torrent and magnet-link parsing, the peer wire protocol with message stream encryption, the DHT, µTP, trackers over HTTP and UDP, web seeds, UPnP port mapping, piece selection and disk storage with preallocation. KTorrent’s interface and plugins sit on top of it, and kget’s BitTorrent transfer plugin is the one other program in the tree that links it.
Depends on: cmake, ninja, extra-cmake-modules, qt6-qtbase, karchive, kcrash, ki18n, kio, solid, boost, gmp, openssl.
Required by (2): kget, ktorrent.
Sources: libktorrent-26.08.2.tar.xz (592.7 KiB). Every step kpkg takes applies to this port.
Install: script/chroot/exec.sh bash -c 'source script/phases/43_toolkits/phase.env && kpkg install libktorrent'
build.sh:
cmake -S . -B build -G Ninja \
-D CMAKE_INSTALL_PREFIX=/usr \
-D KDE_INSTALL_LIBDIR=lib \
-D CMAKE_BUILD_TYPE=Release \
-D KDE_INSTALL_USE_QT_SYS_PATHS=ON \
-D BUILD_TESTING=OFF \
-D KF_SKIP_PO_PROCESSING=ON \
-D USE_CRYPTO_BACKEND=OpenSSL \
-D WITH_XFS=OFF \
-Wno-dev
cmake --build build
DESTDIR=$PKG cmake --install build
-D USE_CRYPTO_BACKEND=OpenSSL— Hashing and the encryption of peer connections through openssl. Upstream’sAutotakes OpenSSL 3 when it finds it and falls back to libgcrypt quietly; naming the backend stops the configure if OpenSSL is missing, so the library never changes backend with what happens to be installed.-D WITH_XFS=OFF— No XFS-specific preallocation. With it, upstream looks forxfs/xfs.hfrom xfsprogs’ development headers without saying whether it found it, and uses XFS’s own reservation ioctl when it does.posix_fallocate()already reserves the space on XFS as on every other filesystem the kernel supports it on, so the switch only removes a silent dependency on which headers are present.-D KF_SKIP_PO_PROCESSING=ON— Builds none of the translation catalogues underpo/, which the package-wide English-only rule would remove anyway (see Size and language policy).
Libraries: libKTorrent6.so.
Directories: /usr/include/libktorrent, /usr/lib/cmake/KTorrent6, /usr/share/licenses/libktorrent.
musl has no separate 64-bit file functions (fopen64, fseeko64, mmap64 and the rest), so the configure’s checks for them fail. That is expected: the code falls back to the plain calls, and off_t is 64 bits wide on musl, so files over 2 GiB work.
boost is a header-only requirement (the configure asks for Boost’s own CMake package, and µTP uses its circular_buffer), and gmp does the Diffie-Hellman arithmetic of the encrypted handshake. The library opens listening sockets for peers, the DHT and µTP only when an application starts a torrent session.
The ktcli example is built with the library and not installed.