gtk-icon-cache.bbclass 1.9 KB

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