Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | FILES_${PN} += "${datadir}/icons/hicolor" |
| 2 | |
| 3 | DEPENDS += "${@['hicolor-icon-theme', '']['${BPN}' == 'hicolor-icon-theme']} gtk-icon-utils-native" |
| 4 | |
| 5 | gtk_icon_cache_postinst() { |
| 6 | if [ "x$D" != "x" ]; then |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 7 | $INTERCEPT_DIR/postinst_intercept update_icon_cache ${PKG} \ |
| 8 | mlprefix=${MLPREFIX} \ |
| 9 | libdir_native=${libdir_native} |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 10 | else |
| 11 | |
| 12 | # Update the pixbuf loaders in case they haven't been registered yet |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 13 | ${libdir}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders --update-cache |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 14 | |
| 15 | for icondir in /usr/share/icons/* ; do |
| 16 | if [ -d $icondir ] ; then |
| 17 | gtk-update-icon-cache -fqt $icondir |
| 18 | fi |
| 19 | done |
| 20 | fi |
| 21 | } |
| 22 | |
| 23 | gtk_icon_cache_postrm() { |
| 24 | if [ "x$D" != "x" ]; then |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 25 | $INTERCEPT_DIR/postinst_intercept update_icon_cache ${PKG} \ |
| 26 | mlprefix=${MLPREFIX} \ |
| 27 | libdir=${libdir} |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 28 | else |
| 29 | for icondir in /usr/share/icons/* ; do |
| 30 | if [ -d $icondir ] ; then |
| 31 | gtk-update-icon-cache -qt $icondir |
| 32 | fi |
| 33 | done |
| 34 | fi |
| 35 | } |
| 36 | |
| 37 | python populate_packages_append () { |
| 38 | packages = d.getVar('PACKAGES', True).split() |
| 39 | pkgdest = d.getVar('PKGDEST', True) |
| 40 | |
| 41 | for pkg in packages: |
| 42 | icon_dir = '%s/%s/%s/icons' % (pkgdest, pkg, d.getVar('datadir', True)) |
| 43 | if not os.path.exists(icon_dir): |
| 44 | continue |
| 45 | |
| 46 | bb.note("adding hicolor-icon-theme dependency to %s" % pkg) |
| 47 | rdepends = ' ' + d.getVar('MLPREFIX', False) + "hicolor-icon-theme" |
| 48 | d.appendVar('RDEPENDS_%s' % pkg, rdepends) |
| 49 | |
| 50 | bb.note("adding gtk-icon-cache postinst and postrm scripts to %s" % pkg) |
| 51 | |
| 52 | postinst = d.getVar('pkg_postinst_%s' % pkg, True) |
| 53 | if not postinst: |
| 54 | postinst = '#!/bin/sh\n' |
| 55 | postinst += d.getVar('gtk_icon_cache_postinst', True) |
| 56 | d.setVar('pkg_postinst_%s' % pkg, postinst) |
| 57 | |
| 58 | postrm = d.getVar('pkg_postrm_%s' % pkg, True) |
| 59 | if not postrm: |
| 60 | postrm = '#!/bin/sh\n' |
| 61 | postrm += d.getVar('gtk_icon_cache_postrm', True) |
| 62 | d.setVar('pkg_postrm_%s' % pkg, postrm) |
| 63 | } |
| 64 | |