1FILES:${PN} += "${datadir}/icons/hicolor" 2 3GTKIC_VERSION ??= '3' 4 5GTKPN = "${@ 'gtk4' if d.getVar('GTKIC_VERSION') == '4' else 'gtk+3' }" 6GTKIC_CMD = "${@ 'gtk4-update-icon-cache' if d.getVar('GTKIC_VERSION') == '4' else 'gtk-update-icon-cache-3.0' }" 7 8#gtk+3/gtk4 require GTK3DISTROFEATURES, DEPENDS on it make all the 9#recipes inherit this class require GTK3DISTROFEATURES 10inherit features_check 11ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}" 12 13DEPENDS +=" ${@ '' if d.getVar('BPN') == 'hicolor-icon-theme' else 'hicolor-icon-theme' } \ 14 ${@ '' if d.getVar('BPN') == 'gdk-pixbuf' else 'gdk-pixbuf' } \ 15 ${@ '' if d.getVar('BPN') == d.getVar('GTKPN') else d.getVar('GTKPN') } \ 16 ${GTKPN}-native \ 17" 18 19PACKAGE_WRITE_DEPS += "${GTKPN}-native gdk-pixbuf-native" 20 21gtk_icon_cache_postinst() { 22if [ "x$D" != "x" ]; then 23 $INTERCEPT_DIR/postinst_intercept update_gtk_icon_cache ${PKG} \ 24 mlprefix=${MLPREFIX} \ 25 libdir_native=${libdir_native} 26else 27 28 # Update the pixbuf loaders in case they haven't been registered yet 29 ${libdir}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders --update-cache 30 31 for icondir in /usr/share/icons/* ; do 32 if [ -d $icondir ] ; then 33 ${GTKIC_CMD} -fqt $icondir 34 fi 35 done 36fi 37} 38 39gtk_icon_cache_postrm() { 40if [ "x$D" != "x" ]; then 41 $INTERCEPT_DIR/postinst_intercept update_gtk_icon_cache ${PKG} \ 42 mlprefix=${MLPREFIX} \ 43 libdir=${libdir} 44else 45 for icondir in /usr/share/icons/* ; do 46 if [ -d $icondir ] ; then 47 ${GTKIC_CMD} -qt $icondir 48 fi 49 done 50fi 51} 52 53python populate_packages:append () { 54 packages = d.getVar('PACKAGES').split() 55 pkgdest = d.getVar('PKGDEST') 56 57 for pkg in packages: 58 icon_dir = '%s/%s/%s/icons' % (pkgdest, pkg, d.getVar('datadir')) 59 if not os.path.exists(icon_dir): 60 continue 61 62 bb.note("adding hicolor-icon-theme dependency to %s" % pkg) 63 rdepends = ' ' + d.getVar('MLPREFIX', False) + "hicolor-icon-theme" 64 d.appendVar('RDEPENDS:%s' % pkg, rdepends) 65 66 #gtk_icon_cache_postinst depend on gdk-pixbuf and gtk+3/gtk4 67 bb.note("adding gdk-pixbuf dependency to %s" % pkg) 68 rdepends = ' ' + d.getVar('MLPREFIX', False) + "gdk-pixbuf" 69 d.appendVar('RDEPENDS:%s' % pkg, rdepends) 70 71 bb.note("adding %s dependency to %s" % (d.getVar('GTKPN'), pkg)) 72 rdepends = ' ' + d.getVar('MLPREFIX', False) + d.getVar('GTKPN') 73 d.appendVar('RDEPENDS:%s' % pkg, rdepends) 74 75 bb.note("adding gtk-icon-cache postinst and postrm scripts to %s" % pkg) 76 77 postinst = d.getVar('pkg_postinst:%s' % pkg) 78 if not postinst: 79 postinst = '#!/bin/sh\n' 80 postinst += d.getVar('gtk_icon_cache_postinst') 81 d.setVar('pkg_postinst:%s' % pkg, postinst) 82 83 postrm = d.getVar('pkg_postrm:%s' % pkg) 84 if not postrm: 85 postrm = '#!/bin/sh\n' 86 postrm += d.getVar('gtk_icon_cache_postrm') 87 d.setVar('pkg_postrm:%s' % pkg, postrm) 88} 89 90