1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-31 00:39:46 +00:00

gtk-icon-cache: Allow using gtk4

meta-openembedded has gtk4 which has its own version of
gtk-update-icon-cache. Allow programs that want to use gtk4
use the proper version of the gtk-update-icon-cache utility
and the proper build and runtime dependencies.

Also use a more readable syntax for conditional values in DEPENDS.

(From OE-Core rev: 2a927a581e599af8e544e17517cdda1cfaf63e16)

Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Zoltán Böszörményi
2022-02-24 14:11:21 +01:00
committed by Richard Purdie
parent 889788bffc
commit f8c99d2d66
+16 -11
View File
@@ -1,17 +1,22 @@
FILES:${PN} += "${datadir}/icons/hicolor" FILES:${PN} += "${datadir}/icons/hicolor"
#gtk+3 reqiure GTK3DISTROFEATURES, DEPENDS on it make all the GTKIC_VERSION ??= '3'
GTKPN = "${@ 'gtk4' if d.getVar('GTKIC_VERSION') == '4' else 'gtk+3' }"
GTKIC_CMD = "${@ 'gtk-update-icon-cache-3.0.0' if d.getVar('GTKIC_VERSION') == '4' else 'gtk4-update-icon-cache' }"
#gtk+3/gtk4 require GTK3DISTROFEATURES, DEPENDS on it make all the
#recipes inherit this class require GTK3DISTROFEATURES #recipes inherit this class require GTK3DISTROFEATURES
inherit features_check inherit features_check
ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}" ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}"
DEPENDS +=" ${@['hicolor-icon-theme', '']['${BPN}' == 'hicolor-icon-theme']} \ DEPENDS +=" ${@ '' if d.getVar('BPN') == 'hicolor-icon-theme' else 'hicolor-icon-theme' } \
${@['gdk-pixbuf', '']['${BPN}' == 'gdk-pixbuf']} \ ${@ '' if d.getVar('BPN') == 'gdk-pixbuf' else 'gdk-pixbuf' } \
${@['gtk+3', '']['${BPN}' == 'gtk+3']} \ ${@ '' if d.getVar('BPN') == d.getVar('GTKPN') else d.getVar('GTKPN') } \
gtk+3-native \ ${GTKPN}-native \
" "
PACKAGE_WRITE_DEPS += "gtk+3-native gdk-pixbuf-native" PACKAGE_WRITE_DEPS += "${GTKPN}-native gdk-pixbuf-native"
gtk_icon_cache_postinst() { gtk_icon_cache_postinst() {
if [ "x$D" != "x" ]; then if [ "x$D" != "x" ]; then
@@ -25,7 +30,7 @@ else
for icondir in /usr/share/icons/* ; do for icondir in /usr/share/icons/* ; do
if [ -d $icondir ] ; then if [ -d $icondir ] ; then
gtk-update-icon-cache -fqt $icondir ${GTKIC_CMD} -fqt $icondir
fi fi
done done
fi fi
@@ -39,7 +44,7 @@ if [ "x$D" != "x" ]; then
else else
for icondir in /usr/share/icons/* ; do for icondir in /usr/share/icons/* ; do
if [ -d $icondir ] ; then if [ -d $icondir ] ; then
gtk-update-icon-cache -qt $icondir ${GTKIC_CMD} -qt $icondir
fi fi
done done
fi fi
@@ -58,13 +63,13 @@ python populate_packages:append () {
rdepends = ' ' + d.getVar('MLPREFIX', False) + "hicolor-icon-theme" rdepends = ' ' + d.getVar('MLPREFIX', False) + "hicolor-icon-theme"
d.appendVar('RDEPENDS:%s' % pkg, rdepends) d.appendVar('RDEPENDS:%s' % pkg, rdepends)
#gtk_icon_cache_postinst depend on gdk-pixbuf and gtk+3 #gtk_icon_cache_postinst depend on gdk-pixbuf and gtk+3/gtk4
bb.note("adding gdk-pixbuf dependency to %s" % pkg) bb.note("adding gdk-pixbuf dependency to %s" % pkg)
rdepends = ' ' + d.getVar('MLPREFIX', False) + "gdk-pixbuf" rdepends = ' ' + d.getVar('MLPREFIX', False) + "gdk-pixbuf"
d.appendVar('RDEPENDS:%s' % pkg, rdepends) d.appendVar('RDEPENDS:%s' % pkg, rdepends)
bb.note("adding gtk+3 dependency to %s" % pkg) bb.note("adding %s dependency to %s" % (d.getVar('GTKPN'), pkg))
rdepends = ' ' + d.getVar('MLPREFIX', False) + "gtk+3" rdepends = ' ' + d.getVar('MLPREFIX', False) + d.getVar('GTKPN')
d.appendVar('RDEPENDS:%s' % pkg, rdepends) d.appendVar('RDEPENDS:%s' % pkg, rdepends)
bb.note("adding gtk-icon-cache postinst and postrm scripts to %s" % pkg) bb.note("adding gtk-icon-cache postinst and postrm scripts to %s" % pkg)