diff --git a/gui-libs/gtk-4.18.6.PKGBUILD b/gui-libs/gtk-4.18.6.PKGBUILD new file mode 100644 index 0000000..a1f95c4 --- /dev/null +++ b/gui-libs/gtk-4.18.6.PKGBUILD @@ -0,0 +1,108 @@ +pkgname=gtk +pkgver=4.18.6 +pkgdesc="GTK is a multi-platform toolkit for creating graphical user interfaces" +homepage="https://www.gtk.org/ https://gitlab.gnome.org/GNOME/gtk/" +license=("LGPL-2+") +depends=( + at-spi2-core + cairo + desktop-file-utils + fontconfig + fribidi + gcc-libs + gdk-pixbuf2 + glib2 + glibc + graphene + gtk-update-icon-cache + harfbuzz + iso-codes + libegl + libpng + librsvg + libxkbcommon + pango + shared-mime-info + vulkan-loader + wayland +) +makedepends=( + docbook-xsl + gobject-introspection + meson + python-gobject + sassc + shaderc + vulkan-headers + wayland-protocols +) +_hook="gtk4-querymodules.HOOK" +_hook_sum="0faeb757f9c9bde8a295c8312c512e9519d6007ad5ee72ac6e65f79d4aec8bc426ece530744e0c36e46df41a2769ff0bcf8ae3c425d3beacae30ddd04f5414ff" +_patches=("0001-gdk-add-a-poison-macro-to-hide-GDK_WINDOWING_ge_4.18.5.patch") +_patch_sums=("3df25aa8c17f7858febf1e0d3171a078736968d90114729830654c0ebaac53e9cf5ce0ab317065ac7eb0a8572f16ceb5d323755138d9ba7c013232b10e0085ab") +sources=("${pkgname}-${pkgver}.tar.xz" + "${_hook}" + "${_patches[@]}" +) +urls=("https://download.gnome.org/sources/${pkgname}/${pkgver%.*}/${sources[0]}" + "${_hook}" + "${_patches[@]}" +) +sha512sums=("636bc3adf01f444dfbf10a3fdce82cdd7b2914b9ff251e98e006a987c3216ef22f5ae8759aa5f2385d1e82813ab8bf2c8adc4f8d6db230e9f507b44fac10e359" + "${_hook_sum}" + "${_patch_sums[@]}" +) + +src_prepare() { + tar -xf ${distdir}/${sources[0]} --strip-components=1 + for _patch in ${_patches[@]}; do + patch -p1 -i ${filedir}/${_patch} + done + + # Nothing should use gtk4-update-icon-cache and an unversioned one is shipped by dev-util/gtk-update-icon-cache + sed -i \ + -e '/gtk4-update-icon-cache/d' \ + docs/reference/gtk/meson.build \ + tools/meson.build +} + +src_build() { + local meson_args=( + --prefix=/usr + --buildtype=release + --wrap-mode=nodownload + -D python.bytecompile=1 + -D x11-backend=false + -D wayland-backend=true + -D broadway-backend=false + -D win32-backend=false + -D android-backend=false + -D macos-backend=false + -D media-gstreamer=disabled + -D print-cpdb=disabled + -D print-cups=disabled + -D vulkan=enabled + -D cloudproviders=disabled + -D sysprof=disabled + -D tracker=disabled + -D colord=disabled + -D f16c=enabled + -D introspection=enabled + -D documentation=false + -D screenshots=false + -D man-pages=true + -D profile=default + -D build-demos=false + -D build-testsuite=false + -D build-examples=false + -D build-tests=false + ) + meson setup build "${meson_args[@]}" +} + +src_install() { + meson install -C build --destdir "$pkgdir" + leaf_install_hook "${filedir}/${_hook}" +} + +# vim:ft=sh syn=sh et sw=2: diff --git a/gui-libs/gtk-4.18.6/0001-gdk-add-a-poison-macro-to-hide-GDK_WINDOWING_ge_4.18.5.patch b/gui-libs/gtk-4.18.6/0001-gdk-add-a-poison-macro-to-hide-GDK_WINDOWING_ge_4.18.5.patch new file mode 100644 index 0000000..18b6dc4 --- /dev/null +++ b/gui-libs/gtk-4.18.6/0001-gdk-add-a-poison-macro-to-hide-GDK_WINDOWING_ge_4.18.5.patch @@ -0,0 +1,93 @@ +From e00bc31abbc489f1787cd5b2d5c441dbb82ed03a Mon Sep 17 00:00:00 2001 +From: Eli Schwartz +Date: Wed, 19 Jun 2024 21:28:31 -0400 +Subject: [PATCH] gdk: add a "poison" macro to hide GDK_WINDOWING_* + +Many packages perform automagic dependencies on gdk's backend +implementations by checking if the macro is defined and then using the +code it unlocks, rather than having a buildsystem option such as +-Dwayland=true. + +It's unfeasible to patch every such package's source code to add +configure options and respect them. Instead add a truly filthy hack and +permit gtk itself to selectively show or hide the windowing system in +use. + +By default, we assume this macro is never defined. It should only ever +be defined inside an ebuild, as such: + +``` +use wayland || append-cflags -DGENTOO_GTK_HIDE_WAYLAND +use X || append-cflags -DGENTOO_GTK_HIDE_X11 +``` + +When seen, this will prevent code using "#ifdef GDK_WINDOWING_*" from +seeing the define, so the automagic dependency won't be picked up. It +will also cause any attempt to #include the backend-specific headers to +bug out. + +Bug: https://bugs.gentoo.org/624960 +Signed-off-by: Eli Schwartz +Signed-off-by: Lukas Schmelting +--- + gdk/gdkconfig.h.meson | 7 +++++++ + gdk/wayland/gdkwayland.h | 4 ++++ + gdk/x11/gdkx.h | 4 ++++ + 3 files changed, 15 insertions(+) + +diff --git a/gdk/gdkconfig.h.meson b/gdk/gdkconfig.h.meson +index 17276e0..03cf61c 100644 +--- a/gdk/gdkconfig.h.meson ++++ b/gdk/gdkconfig.h.meson +@@ -10,11 +10,18 @@ + G_BEGIN_DECLS + + ++#ifndef GENTOO_GTK_HIDE_X11 + #mesondefine GDK_WINDOWING_X11 ++#endif ++ + #mesondefine GDK_WINDOWING_ANDROID + #mesondefine GDK_WINDOWING_BROADWAY + #mesondefine GDK_WINDOWING_MACOS ++ ++#ifndef GENTOO_GTK_HIDE_WAYLAND + #mesondefine GDK_WINDOWING_WAYLAND ++#endif ++ + #mesondefine GDK_WINDOWING_WIN32 + + #mesondefine GDK_RENDERING_CAIRO +diff --git a/gdk/wayland/gdkwayland.h b/gdk/wayland/gdkwayland.h +index 8464459..5d84619 100644 +--- a/gdk/wayland/gdkwayland.h ++++ b/gdk/wayland/gdkwayland.h +@@ -24,6 +24,10 @@ + + #pragma once + ++#ifdef GENTOO_GTK_HIDE_WAYLAND ++ #error "A Gentoo ebuild has hidden wayland and it cannot be used in this compilation unit. Please file a bug if you see this error." ++#endif ++ + #include + + #define __GDKWAYLAND_H_INSIDE__ +diff --git a/gdk/x11/gdkx.h b/gdk/x11/gdkx.h +index 6bef6b6..d4f8b94 100644 +--- a/gdk/x11/gdkx.h ++++ b/gdk/x11/gdkx.h +@@ -24,6 +24,10 @@ + + #pragma once + ++#ifdef GENTOO_GTK_HIDE_X11 ++ #error "A Gentoo ebuild has hidden x11 and it cannot be used in this compilation unit. Please file a bug if you see this error." ++#endif ++ + #include + + #include +-- +2.49.0 + diff --git a/gui-libs/gtk-4.18.6/gtk4-querymodules.HOOK b/gui-libs/gtk-4.18.6/gtk4-querymodules.HOOK new file mode 100644 index 0000000..d4d6467 --- /dev/null +++ b/gui-libs/gtk-4.18.6/gtk4-querymodules.HOOK @@ -0,0 +1,5 @@ +target=(/usr/lib/gtk-4.0/4.0.0/*) +triggers=("install" "remove") +operation() { + gio-querymodules /usr/lib/gtk-4.0/4.0.0/ +}