296.3. kleopatra-26.08.2
Certificate manager and graphical front end to GnuPG — OpenPGP and S/MIME keys, signing and encryption
| Version | 26.08.2, release 1 |
| Shelf | security — Security applications: GnuPG and front-ends, password and secret managers, certificates, scanners, forensics and audit |
| Phase | 44_apps (Applications), 361 of 422 in build order |
| Licence | GPL-2.0-or-later |
| Homepage | https://apps.kde.org/kleopatra/ |
| Build time | 33.6 SBU |
| Installed size | 8.3 MiB in 44 files |
| Recipe | ports/core/security/kleopatra/kpkgbuild |
About
Kleopatra is KDE’s certificate manager and graphical front end to GnuPG. It creates, imports, exports and certifies OpenPGP and S/MIME keys, signs and encrypts files and folders, decrypts and verifies them, and works on the clipboard. It talks to GnuPG through gpgmepp and qgpgme, with most of its key-handling widgets in libkleo. The port also builds KWatchGnuPG, a viewer for the logs of the GnuPG daemons.
Sources
kleopatra-26.08.2.tar.xz(2.8 MiB)
sha256b3482904c09bac5394b27432c1f91b66860e9fabb33b48302c24086d76726c5d
upstream: https://download.kde.org/stable/release-service/26.08.2/src/kleopatra-26.08.2.tar.xz
archive copy: sources-4/security--kleopatra-26.08.2.tar.xz
Dependencies
Depends on: cmake, ninja, extra-cmake-modules, qt6-qtbase, kcodecs, kcolorscheme, kconfig, kcoreaddons, kcrash, ki18n, kiconthemes, kitemmodels, kio, kwidgetsaddons, kwindowsystem, kxmlgui, kdoctools, kmime, libkleo, mimetreeparser, kidentitymanagement, kmailtransport, akonadi-mime, kdsingleapplication, gpgmepp, qgpgme, libassuan, libgpg-error, gnupg, pinentry.
Required by (1): kde-gear-utilities.
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 kleopatra'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/security/kleopatra.
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/security/kleopatra
echo 'b3482904c09bac5394b27432c1f91b66860e9fabb33b48302c24086d76726c5d kleopatra-26.08.2.tar.xz' | 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/kleopatra
SRC=$SRC_ROOT/kleopatra-26.08.2
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf kleopatra-26.08.2.tar.xz -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:
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_UNITY_CMAKE_SUPPORT=OFF \
-D USE_DBUS=ON \
-D DISABLE_KWATCHGNUPG=OFF \
-D CMAKE_REQUIRE_FIND_PACKAGE_KF6DocTools=ON \
-D CMAKE_REQUIRE_FIND_PACKAGE_KPim6IdentityManagementCore=ON \
-D CMAKE_REQUIRE_FIND_PACKAGE_KPim6MailTransport=ON \
-D CMAKE_REQUIRE_FIND_PACKAGE_KPim6AkonadiMime=ON \
-Wno-dev
cmake --build build
DESTDIR=$PKG cmake --install build
cat > "$PKG/usr/share/applications/org.kde.kleopatra.desktop" <<'EOF2'
[Desktop Entry]
Type=Application
Name=Kleopatra
GenericName=Certificate Manager
Comment=OpenPGP and S/MIME keys, signing and encryption with GnuPG
Exec=kleopatra
Icon=kleopatra
Terminal=false
StartupNotify=true
StartupWMClass=org.kde.kleopatra
Categories=Qt;KDE;Utility;Security;
Keywords=gpg;gnupg;pgp;openpgp;smime;key;certificate;encrypt;decrypt;sign;verify;
X-DocPath=kleopatra/index.html
EOF2
cat > "$PKG/usr/share/applications/org.kde.kwatchgnupg.desktop" <<'EOF2'
[Desktop Entry]
Type=Application
Name=GnuPG Log Viewer
Comment=Viewer for GnuPG daemon and application logs
Exec=kwatchgnupg
Icon=org.kde.kwatchgnupg
Terminal=false
StartupWMClass=org.kde.kwatchgnupg
SingleMainWindow=true
Categories=Qt;KDE;System;Security;
Keywords=gpg;gnupg;log;watch;kwatchgnupg;
EOF2
cat > "$PKG/usr/share/applications/org.kde.kleopatra.decryptverify.desktop" <<'EOF2'
[Desktop Entry]
Type=Application
Name=Kleopatra (Decrypt/Verify)
Comment=Decrypt and verify OpenPGP files
Exec=kleopatra --decrypt-verify -- %F
Icon=kleopatra
Terminal=false
NoDisplay=true
MimeType=application/pgp-encrypted;application/pgp-signature;
Categories=Qt;KDE;Utility;Security;
EOF2
chmod 644 "$PKG"/usr/share/applications/org.kde.kleopatra.desktop \
"$PKG"/usr/share/applications/org.kde.kwatchgnupg.desktop \
"$PKG"/usr/share/applications/org.kde.kleopatra.decryptverify.desktop
The switches, and why each is set:
-D KF_SKIP_PO_PROCESSING=ON— compile none of the translation catalogues inpo/. kpkg removes every non-English catalogue from the package anyway (see size and language policy), so this only saves build time.-D USE_UNITY_CMAKE_SUPPORT=OFF— compile each source file on its own instead of in CMake “unity” batches, which upstream offers to speed up compilation. This is upstream’s default.-D USE_DBUS=ON— build the parts that use D-Bus: talking between instances, so that a file opened from outside goes to the Kleopatra already running, and the presentation-related bits upstream lists. On by default on Linux; named so it stays on.-D DISABLE_KWATCHGNUPG=OFF— build KWatchGnuPG. This is upstream’s default.-D CMAKE_REQUIRE_FIND_PACKAGE_KF6DocTools=ON— Kleopatra’s and KWatchGnuPG’s handbooks are built only when kdoctools is found; required, a missing kdoctools stops the configure instead of quietly dropping the handbooks (see a graphical application).-D CMAKE_REQUIRE_FIND_PACKAGE_KPim6IdentityManagementCore=ON— with-D CMAKE_REQUIRE_FIND_PACKAGE_KPim6MailTransport=ONand-D CMAKE_REQUIRE_FIND_PACKAGE_KPim6AkonadiMime=ON: require kidentitymanagement, kmailtransport and akonadi-mime, the three KDE PIM libraries behind “Publish at Mail Provider”, which sends an OpenPGP key to the mail provider’s Web Key Service from the user’s mail identity. Upstream builds the command only when all three are found and otherwise leaves it out without an error.
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/kleopatra, 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 kleopatra-26.08.2-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/kleopatra, and runs the triggers its paths call for.
Contents
Installed programs: kleopatra, kwatchgnupg.
Installed directories: /usr/share/doc/HTML/en/kleopatra, /usr/share/doc/HTML/en/kwatchgnupg, /usr/share/licenses/kleopatra.
Notes
build.sh writes its own org.kde.kleopatra.desktop and org.kde.kwatchgnupg.desktop over upstream’s, which have no StartupWMClass. KAboutData sets each program’s desktop file name from the kde.org domain, so the Wayland app ids are org.kde.kleopatra and org.kde.kwatchgnupg, not the program names, and the replacement entries name those ids. They also add search keywords and the Security category.
Upstream’s main entry claims no MIME type; opening key and certificate files is left to upstream’s kleopatra_import.desktop, which is installed unchanged. Upstream’s decrypt-and-verify is only a KIO service menu, kleopatra_decryptverifyfiles.desktop under /usr/share/kio/servicemenus, and a service menu cannot be a default application: the MIME lookup reads /usr/share/applications alone and would pass an encrypted file to KGpg. build.sh therefore also writes org.kde.kleopatra.decryptverify.desktop, a hidden application entry that runs kleopatra --decrypt-verify -- %F for application/pgp-encrypted and application/pgp-signature; KDOS’s default-applications list names it for both. It carries no StartupWMClass, so the panel keeps tying Kleopatra’s window to the main entry.
“Publish at Mail Provider” queues the request through Akonadi’s outbox, on the mail identity and transport KMail sets up, so it sends only once a KMail account exists and the Akonadi server runs. Without them Kleopatra’s other ways of sending a key, a keyserver upload and an exported file, are unaffected.