253.3. gtk4-4.24.0
GTK 4 widget toolkit, with the Wayland and X11 backends, Vulkan and GStreamer media
| Version | 4.24.0, release 1 |
| Shelf | gtk — The GLib and GTK platform and GNOME/Xfce desktop-platform libraries: widgets, settings, bindings, GIO plug-ins |
| Phase | 43_toolkits (Toolkits), 160 of 344 in build order |
| Licence | LGPL-2.1-or-later |
| Homepage | https://www.gtk.org/ |
| Build time | 6.4 SBU |
| Installed size | 49.2 MiB in 511 files |
| Recipe | ports/core/gtk/gtk4/kpkgbuild |
About
GTK 4 is the current GTK widget toolkit, and the one libadwaita is built on. It installs beside gtk3. It draws with OpenGL or Vulkan through its GSK renderers and plays video through GStreamer. It is for applications: the KDOS desktop is Qt 6 and KDE Frameworks, and no part of it links GTK (see Applications bring their own toolkit).
Why it is in KDOS
The comment above gtk3 and gtk4 in script/phases/43_toolkits/packages.d/gtk.txt:
Both GTKs are built with their Wayland and X11 backends. GDK_BACKEND is left unset, so an application tries Wayland first and the X11 backend serves the ones that force it; GTK 3's AT-SPI bridge is compiled only beside its X11 backend.
Sources
gtk4-4.24.0.tar.xz(16.8 MiB)
sha25628ba4ac1c04f86eac09b79a163cb163a4c2b54442d9f7eccc04679062a581044
upstream: https://download.gnome.org/sources/gtk/4.24/gtk-4.24.0.tar.xz
archive copy: sources-2/gtk--gtk4-4.24.0.tar.xz
Dependencies
Depends on: meson, glib, gobject-introspection, glib-introspection, cairo, pango, harfbuzz, fribidi, gdk-pixbuf, librsvg, libpng, libtiff, libjpeg-turbo, libepoxy, graphene, libxkbcommon, wayland, wayland-protocols, libX11, libXext, libXrender, libXi, libXrandr, libXcursor, libXdamage, libXfixes, libXinerama, fontconfig, freetype2, cups, gstreamer, gst-plugins-base, gst-plugins-bad, vulkan-headers, vulkan-loader, shaderc, libdrm, iso-codes, shared-mime-info, hicolor-icon-theme, at-spi2-core, bash-completion, python3-docutils.
Required by (22): blueprint-compiler, celluloid, deja-dup, dino, fcitx5-gtk, font-manager, gnome-mahjongg, gnome-mines, gnome-sudoku, gthumb, gtkmm4, gtksourceview5, handbrake, impression, libadwaita, libportal, libspelling, lxi-tools, resources, vte3, webkitgtk6, zenity.
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/43_toolkits/phase.env && kpkg install gtk4'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/gtk/gtk4.
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/gtk/gtk4
echo '28ba4ac1c04f86eac09b79a163cb163a4c2b54442d9f7eccc04679062a581044 gtk4-4.24.0.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/gtk4
SRC=$SRC_ROOT/gtk4-4.24.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf gtk4-4.24.0.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 recipe’s helpers devseries and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
meson setup build \
--prefix=/usr --sysconfdir=/etc --libdir=lib \
--buildtype=release \
-Db_ndebug=if-release \
-Dwayland-backend=true \
-Dx11-backend=true \
-Dbroadway-backend=false \
-Dmedia-gstreamer=enabled \
-Dprint-cups=enabled \
-Dprint-cpdb=disabled \
-Dvulkan=enabled \
-Dcloudproviders=disabled \
-Dsysprof=disabled \
-Dtracker=disabled \
-Dcolord=disabled \
-Daccesskit=disabled \
-Dintrospection=enabled \
-Ddocumentation=false \
-Dscreenshots=false \
-Dman-pages=true \
-Dbuild-demos=false \
-Dbuild-testsuite=false \
-Dbuild-examples=false \
-Dbuild-tests=false
meson compile -C build
DESTDIR=$PKG meson install --no-rebuild -C build
The switches, and why each is set:
-Db_ndebug=if-release— DefineNDEBUGin a release build, which removes theassert()checks in the roaring bitmaps underGtkBitset, walked on every list-view update. gtk4 is one of the few ports that pass it; GTK’s ownG_DISABLE_ASSERTfollows the optimisation level and needs no switch (see meson).-Dwayland-backend=true,-Dx11-backend=true— Build both GDK backends, upstream’s defaults on Linux.GDK_BACKENDis left unset in the session, so an application tries Wayland first and the X11 backend serves the ones that force it, under Xwayland (see A graphical application).-Dbroadway-backend=false— Build no Broadway backend, which draws a GTK program into a web browser over HTML5. It is upstream’s default.-Dmedia-gstreamer=enabled— Build the GStreamer media backend behindGtkVideoandGtkMediaFile. It needsgstreamer-play-1.0from gst-plugins-bad and the GL and allocator libraries of gst-plugins-base.enabled, which is upstream’s default, makes a missing one stop the configure.-Dprint-cups=enabled— Build the cups print backend, and fail if CUPS is not found. Upstream’sautobuilds without it when CUPS is missing.-Dprint-cpdb=disabled— No Common Print Dialog Backends backend. cpdb is not a port, and the option is off by default.-Dvulkan=enabled— Build the Vulkan renderer. The configure requires the vulkan-loader andglslcfrom shaderc, which compiles the renderer’s shaders at build time. It is upstream’s default.-Dcloudproviders=disabled,-Dsysprof=disabled,-Dtracker=disabled,-Dcolord=disabled,-Daccesskit=disabled— No cloud-provider entries in the file chooser (libcloudproviders), no sysprof tracing, no Tracker search in the file chooser, no colord support in the CUPS backend, and no AccessKit accessibility backend; accessibility goes through AT-SPI. None of these libraries is a port, and each option is off by default.-Dman-pages=true— Build the manual pages of the installed tools, such asgtk4-builder-tool, withrst2manfrom python3-docutils.-Dbuild-testsuite=false,-Dbuild-demos=false,-Dbuild-examples=false,-Dbuild-tests=false— Build none of the test suite,gtk4-demo,gtk4-widget-factoryor the examples, all on by default upstream.
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/gtk4, 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 gtk4-4.24.0-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/gtk4, and runs the triggers its paths call for.
Contents
Installed programs: gtk4-builder-tool, gtk4-image-tool, gtk4-launch, gtk4-path-tool, gtk4-query-settings, gtk4-rendernode-tool, gtk4-update-icon-cache.
Installed libraries: libgtk-4.so.
Installed directories: /usr/include/gtk-4.0, /usr/share/gtk-4.0, /usr/share/licenses/gtk4.
Short descriptions
gtk4-builder-tool |
GtkBuilder File Utility |
gtk4-image-tool |
Image Utility |
gtk4-launch |
Launch an application |
gtk4-path-tool |
GskPath Utility |
gtk4-query-settings |
Print name and value of GTK settings |
gtk4-rendernode-tool |
GskRenderNode Utility |
gtk4-update-icon-cache |
Icon theme caching utility |
gtk4.pc |
GTK Graphical UI Library |
gtk4-atspi.pc |
GTK AT-SPI accessibility support |
gtk4-unix-print.pc |
GTK Unix print support |
gtk4-wayland.pc |
GTK Graphical UI Library |
gtk4-x11.pc |
GTK Graphical UI Library |