diff options
author | Baptiste Daroussin <bapt@FreeBSD.org> | 2021-09-14 15:24:59 +0000 |
---|---|---|
committer | Baptiste Daroussin <bapt@FreeBSD.org> | 2021-10-10 17:46:46 +0000 |
commit | 46bcb098c82f7a18c7667fc99f6a7824b2b6eeef (patch) | |
tree | 9c7a40b3df957835414b86416fa147224195960e | |
parent | 6f5d234138dcb857baea070853fbc9a7736f408b (diff) | |
download | ports-46bcb098c82f7a18c7667fc99f6a7824b2b6eeef.tar.gz ports-46bcb098c82f7a18c7667fc99f6a7824b2b6eeef.zip |
graphics/gtk-update-icon-cache: use triggers
Use triggers instead of enforcing the INSTALL_ICONS which enforces
gtk-update-icon-cache dependency on every ports installing icons.
The bonus:
- factorize gtk-update-icon-cache update at the end of the build
- stop adding a gratuicious dependency on gtk-update-icon-cache on
packages which do not need it
- works on packages where INSTALLS_ICONS were forgotten
PR: 258502
Exp-run: antoine
Reviewed by: tcberner
Differential Revision: https://reviews.freebsd.org/D31960
-rw-r--r-- | graphics/gtk-update-icon-cache/Makefile | 3 | ||||
-rw-r--r-- | graphics/gtk-update-icon-cache/files/gtk-update-icon-cache.ucl.in | 30 |
2 files changed, 32 insertions, 1 deletions
diff --git a/graphics/gtk-update-icon-cache/Makefile b/graphics/gtk-update-icon-cache/Makefile index 495ea3ae2ca2..9f36054ee9a7 100644 --- a/graphics/gtk-update-icon-cache/Makefile +++ b/graphics/gtk-update-icon-cache/Makefile @@ -2,6 +2,7 @@ PORTNAME= gtk-update-icon-cache PORTVERSION= 3.24.26 +PORTREVISION= 1 CATEGORIES= graphics DIST_SUBDIR= gnome @@ -11,7 +12,7 @@ COMMENT= Gtk-update-icon-cache utility from the Gtk+ toolkit LICENSE= LGPL20 LICENSE_FILE= ${WRKSRC}/COPYING -USES= gettext gnome meson pkgconfig +USES= gettext gnome meson pkgconfig trigger USE_GNOME= gdkpixbuf2 USE_GITLAB= yes GL_SITE= https://gitlab.gnome.org diff --git a/graphics/gtk-update-icon-cache/files/gtk-update-icon-cache.ucl.in b/graphics/gtk-update-icon-cache/files/gtk-update-icon-cache.ucl.in new file mode 100644 index 000000000000..faa02503c7f4 --- /dev/null +++ b/graphics/gtk-update-icon-cache/files/gtk-update-icon-cache.ucl.in @@ -0,0 +1,30 @@ +path_glob: "*/share/icons/*" +trigger: { + type: lua + sandbox: false + script: <<EOS +-- make sure we only get the path one level after share/icons +-- Ensure each path is uniq +local hash = {} +for _,path in ipairs(arg) do + path = string.match(path, ".*share/icons/[^/]*") + if (not hash[path]) and pkg.stat(path) then + local res = pkg.readdir(path) + if #res == 1 and res[1] == "icon-theme.cache" then + os.remove(path .. "/" .. res[1]) + os.remove(path) + -- remove share icons if empty + local share_icons = path:gsub("(.*share/icons)/.*", "%1") + local res = pkg.readdir(share_icons) + if #res == 0 then + os.remove(share_icons) + end + else + print("Generating GTK icon cache for " .. path) + pkg.exec({"%%PREFIX%%/bin/gtk-update-icon-cache", "-q", "-t", "-f", path}) + end + hash[path] = true + end +end +EOS +} |