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