283.4. kcachegrind-26.08.2
Profile data visualiser for Callgrind and Cachegrind — call graphs, treemaps and annotated source
| Version | 26.08.2, release 1 |
| Shelf | devtools — Debuggers, tracers, profilers, analysers, linters, language servers and developer utilities |
| Phase | 44_apps (Applications), 47 of 422 in build order |
| Licence | GPL-2.0-only AND (LGPL-2.1-only WITH Qt-LGPL-exception-1.1 OR LGPL-3.0-only WITH Qt-LGPL-exception-1.1 OR LicenseRef-Qt-Commercial) AND GFDL-1.2-or-later AND CC0-1.0 |
| Homepage | https://apps.kde.org/kcachegrind/ |
| Build time | 2.4 SBU |
| Installed size | 2.2 MiB in 25 files |
| Recipe | ports/core/devtools/kcachegrind/kpkgbuild |
About
KCachegrind visualises the profiles Valgrind’s Callgrind and Cachegrind tools write: costs per function, callers and callees, a call graph, a treemap, and source and assembly annotated with the cost of each line. It reads any file in the Callgrind format, so the converters it installs open OProfile, Perl and memprof profiles too.
Sources
kcachegrind-26.08.2.tar.xz(997.9 KiB)
sha256641a809f7ba5a97637820222b6c7fc639d7bc5d4a1036c69c4886823edb0670a
upstream: https://download.kde.org/stable/release-service/26.08.2/src/kcachegrind-26.08.2.tar.xz
archive copy: sources-1/devtools--kcachegrind-26.08.2.tar.xz
Dependencies
Depends on: cmake, ninja, extra-cmake-modules, qt6-qtbase, karchive, kconfig, kcoreaddons, kdbusaddons, kdoctools, ki18n, kio, kwidgetsaddons, kxmlgui, perl, graphviz, valgrind.
Required by (1): kde-gear-devtools.
Patches
build.sh applies these; kpkg applies nothing by itself.
The desktop entry’s StartupWMClass is upstream’s kcachegrind, but the program sets its desktop file name, and with it the window’s Wayland app_id, to org.kde.kcachegrind; app-id.patch sets the class to the app_id so the task manager matches the window to its entry.
app-id.patch— set the desktop entry's StartupWMClass to the Wayland app_id, org.kde.kcachegrind
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 kcachegrind'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/devtools/kcachegrind.
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/devtools/kcachegrind
echo '641a809f7ba5a97637820222b6c7fc639d7bc5d4a1036c69c4886823edb0670a kcachegrind-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/kcachegrind
SRC=$SRC_ROOT/kcachegrind-26.08.2
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf kcachegrind-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:
patch -p1 -i "$PORT_SRC/app-id.patch"
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 CMAKE_REQUIRE_FIND_PACKAGE_KF6DocTools=ON \
-Wno-dev
cmake --build build
DESTDIR=$PKG cmake --install build
rm "$PKG/usr/bin/hotshot2calltree" "$PKG/usr/bin/pprof2calltree"
The switches, and why each is set:
-D CMAKE_REQUIRE_FIND_PACKAGE_KF6DocTools=ON— Make kdoctools a requirement. Upstream finds it as optional and drops the handbook without one.-D KF_SKIP_PO_PROCESSING=ON— Builds none of the translations inpo/andpoqm/, which kpkg’s English-only rule would remove from the package anyway (see Size and language policy). With it, ECM’secm_install_po_files_as_qm()skips everypoqm/catalogue before it looks for Qt’slconvert, so qt6-qttools is not a build dependency.-Wno-dev— Silences CMake’s warnings meant for the project’s own developers.
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/kcachegrind, 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 kcachegrind-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/kcachegrind, and runs the triggers its paths call for.
Contents
Installed programs: dprof2calltree, kcachegrind, memprof2calltree, op2calltree.
Installed directories: /usr/share/doc/HTML/en/kcachegrind, /usr/share/kcachegrind, /usr/share/licenses/kcachegrind.
Notes
build.sh removes two of the converters the install puts in /usr/bin. hotshot2calltree is Python 2 (a print statement and Python 2’s hotshot module), so no Python here can run it, and pprof2calltree is PHP, which is not a port. The three that stay, op2calltree, dprof2calltree and memprof2calltree, are Perl, so perl is in depends for run time.
The call graph view runs dot from graphviz, and the profiles come from valgrind; both are in depends for run time only. qcachegrind, the Qt-only build of the same viewer, is compiled with the rest and not installed.