lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | FILES_${PN} += "${datadir}/icons/hicolor" |
| 2 | |
| 3 | DEPENDS +=" ${@['hicolor-icon-theme', '']['${BPN}' == 'hicolor-icon-theme']} gtk+3-native" |
| 4 | |
| 5 | PACKAGE_WRITE_DEPS += "gtk+3-native gdk-pixbuf-native" |
| 6 | |
| 7 | gtk_icon_cache_postinst() { |
| 8 | if [ "x$D" != "x" ]; then |
| 9 | $INTERCEPT_DIR/postinst_intercept update_gtk_icon_cache ${PKG} \ |
| 10 | mlprefix=${MLPREFIX} \ |
| 11 | libdir_native=${libdir_native} |
| 12 | else |
| 13 | |
| 14 | # Update the pixbuf loaders in case they haven't been registered yet |
| 15 | ${libdir}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders --update-cache |
| 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 |
| 27 | $INTERCEPT_DIR/postinst_intercept update_gtk_icon_cache ${PKG} \ |
| 28 | mlprefix=${MLPREFIX} \ |
| 29 | libdir=${libdir} |
| 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 () { |
| 40 | packages = d.getVar('PACKAGES').split() |
| 41 | pkgdest = d.getVar('PKGDEST') |
| 42 | |
| 43 | for pkg in packages: |
| 44 | icon_dir = '%s/%s/%s/icons' % (pkgdest, pkg, d.getVar('datadir')) |
| 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 | |
| 54 | postinst = d.getVar('pkg_postinst_%s' % pkg) |
| 55 | if not postinst: |
| 56 | postinst = '#!/bin/sh\n' |
| 57 | postinst += d.getVar('gtk_icon_cache_postinst') |
| 58 | d.setVar('pkg_postinst_%s' % pkg, postinst) |
| 59 | |
| 60 | postrm = d.getVar('pkg_postrm_%s' % pkg) |
| 61 | if not postrm: |
| 62 | postrm = '#!/bin/sh\n' |
| 63 | postrm += d.getVar('gtk_icon_cache_postrm') |
| 64 | d.setVar('pkg_postrm_%s' % pkg, postrm) |
| 65 | } |
| 66 | |