From cbff73fb3423bd30a9a75638332829dd13af399e Mon Sep 17 00:00:00 2001 From: EnumDev Date: Thu, 17 Jul 2025 13:39:48 +0300 Subject: [PATCH] Split package and add BPM hooks --- pkg.info | 7 ++++++ source-files/gtk-update-icon-cache.bpmhook | 5 ++++ source-files/gtk-update-icon-cache.sh | 7 ++++++ source-files/gtk4-querymodules.bpmhook | 5 ++++ source-files/gtk4-querymodules.sh | 6 +++++ source.sh | 27 +++++++++++++++++++++- 6 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 source-files/gtk-update-icon-cache.bpmhook create mode 100644 source-files/gtk-update-icon-cache.sh create mode 100644 source-files/gtk4-querymodules.bpmhook create mode 100644 source-files/gtk4-querymodules.sh diff --git a/pkg.info b/pkg.info index 3539623..847804a 100644 --- a/pkg.info +++ b/pkg.info @@ -1,9 +1,16 @@ name: gtk4 description: GObject-based multi-platform GUI toolkit version 4 version: 4.16.12 +revision: 2 url: https://www.gtk.org/ license: LGPL2.1-or-later architecture: any depends: ["adwaita-icon-theme","at-spi2-core","cairo","cups","desktop-file-utils","fontconfig","fribidi","gcc","gdk-pixbuf","glib","glibc","graphene","gstreamer","gst-plugins-bad","gst-plugins-base","harfbuzz","iso-codes","libepoxy","libglvnd","libjpeg-turbo","libpng","librsvg","libtiff","libx11","libxcursor","libxdamage","libxext","libxfixes","libxi","libxinerama","libxkbcommon","libxrandr","libxrender","pango","shared-mime-info","vulkan-loader","wayland"] make_depends: ["docbook-xsl-nons","gobject-introspection","hicolor-icon-theme","meson","python-pygobject","sassc","shaderc","vulkan-headers","wayland-protocols"] type: source +split_packages: + - name: gtk4 + depends: ["adwaita-icon-theme","at-spi2-core","cairo","cups","desktop-file-utils","fontconfig","fribidi","gcc","gdk-pixbuf","glib","glibc","graphene","gstreamer","gst-plugins-bad","gst-plugins-base","gtk-update-icon-cache","harfbuzz","iso-codes","libepoxy","libglvnd","libjpeg-turbo","libpng","librsvg","libtiff","libx11","libxcursor","libxdamage","libxext","libxfixes","libxi","libxinerama","libxkbcommon","libxrandr","libxrender","pango","shared-mime-info","vulkan-loader","wayland"] + - name: gtk-update-icon-cache + description: The gtk-update-icon-cache binary + depends: ["gdk-pixbuf","glib","glibc","hicolor-icon-theme","librsvg"] diff --git a/source-files/gtk-update-icon-cache.bpmhook b/source-files/gtk-update-icon-cache.bpmhook new file mode 100644 index 0000000..cbcdcf0 --- /dev/null +++ b/source-files/gtk-update-icon-cache.bpmhook @@ -0,0 +1,5 @@ +trigger_operations: ["install", "upgrade"] +target_type: "path" +targets: ["usr/share/icons/*/"] +depends: ["gtk-update-icon-cache"] +run: "/var/lib/bpm/hook-scripts/gtk-update-icon-cache.sh" diff --git a/source-files/gtk-update-icon-cache.sh b/source-files/gtk-update-icon-cache.sh new file mode 100644 index 0000000..d460606 --- /dev/null +++ b/source-files/gtk-update-icon-cache.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +for icons in /usr/share/icons/*; do + if [ -e "$icons"/index.theme ]; then + gtk-update-icon-cache -q -f "$icons" + fi +done diff --git a/source-files/gtk4-querymodules.bpmhook b/source-files/gtk4-querymodules.bpmhook new file mode 100644 index 0000000..5cda3a6 --- /dev/null +++ b/source-files/gtk4-querymodules.bpmhook @@ -0,0 +1,5 @@ +trigger_operations: ["install", "upgrade"] +target_type: "path" +targets: ["usr/lib/gtk-4.0/4.0.0/*/"] +depends: ["gtk4","glib"] +run: "/var/lib/bpm/hook-scripts/gtk4-querymodules.sh" diff --git a/source-files/gtk4-querymodules.sh b/source-files/gtk4-querymodules.sh new file mode 100644 index 0000000..1476bb7 --- /dev/null +++ b/source-files/gtk4-querymodules.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +for dir in /usr/lib/gtk-4.0/4.0.0/*/; do + [ -d "$dir" ] || continue + gio-querymodules "$dir" +done diff --git a/source.sh b/source.sh index 3b3468c..29f7b1e 100644 --- a/source.sh +++ b/source.sh @@ -29,10 +29,35 @@ build() { # The package function is executed in the source directory # This function is used to move the compiled files into the output directory -package() { +package_gtk4() { cd build meson install --destdir="$BPM_OUTPUT" + # Move gtk-update-icon-cache to temporary directory for gtk-update-icon-cache package + mkdir "$BPM_WORKDIR"/output-gtk-update-icon-cache + install -d "$BPM_WORKDIR"/output-gtk-update-icon-cache/usr/{bin,share/man/man1} + mv "$BPM_OUTPUT"/usr/bin/gtk4-update-icon-cache -t "$BPM_WORKDIR"/output-gtk-update-icon-cache/usr/bin/ + + # Install BPM hook and script + install -Dm644 "$BPM_WORKDIR"/gtk4-querymodules.bpmhook "$BPM_OUTPUT"/var/lib/bpm/hooks/gtk4-querymodules.bpmhook + install -Dm755 "$BPM_WORKDIR"/gtk4-querymodules.sh "$BPM_OUTPUT"/var/lib/bpm/hook-scripts/gtk4-querymodules.sh + install -Dm644 "$BPM_SOURCE"/COPYING "$BPM_OUTPUT"/usr/share/licenses/gtk3/COPYING } + +package_gtk-update-icon-cache() { + # Replace 'output' directory with 'output-gtk-update-icon-cache' + rmdir "$BPM_OUTPUT" + mv "$BPM_WORKDIR"/output-gtk-update-icon-cache "$BPM_OUTPUT" + + # Symlink 'gtk-update-icon-cache' to 'gtk4-update-icon-cache' + ln -s gtk4-update-icon-cache "$BPM_OUTPUT"/usr/bin/gtk-update-icon-cache + + # Install BPM hook and script + install -Dm644 "$BPM_WORKDIR"/gtk-update-icon-cache.bpmhook "$BPM_OUTPUT"/var/lib/bpm/hooks/gtk-update-icon-cache.bpmhook + install -Dm755 "$BPM_WORKDIR"/gtk-update-icon-cache.sh "$BPM_OUTPUT"/var/lib/bpm/hook-scripts/gtk-update-icon-cache.sh + + # Install package license + install -Dm644 "$BPM_SOURCE"/COPYING "$BPM_OUTPUT"/usr/share/licenses/gtk-update-icon-cache/COPYING +}