pixbufcache.bbclass 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #
  2. # This class will generate the proper postinst/postrm scriptlets for pixbuf
  3. # packages.
  4. #
  5. DEPENDS_append_class-target = " qemu-native"
  6. inherit qemu
  7. PIXBUF_PACKAGES ??= "${PN}"
  8. PACKAGE_WRITE_DEPS += "qemu-native gdk-pixbuf-native"
  9. pixbufcache_common() {
  10. if [ "x$D" != "x" ]; then
  11. $INTERCEPT_DIR/postinst_intercept update_pixbuf_cache ${PKG} mlprefix=${MLPREFIX} binprefix=${MLPREFIX} libdir=${libdir} \
  12. bindir=${bindir} base_libdir=${base_libdir}
  13. else
  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. if [ -x ${bindir}/gtk-update-icon-cache ] && [ -d ${datadir}/icons ]; then
  17. for icondir in /usr/share/icons/*; do
  18. if [ -d ${icondir} ]; then
  19. gtk-update-icon-cache -t -q ${icondir}
  20. fi
  21. done
  22. fi
  23. fi
  24. }
  25. python populate_packages_append() {
  26. pixbuf_pkgs = d.getVar('PIXBUF_PACKAGES').split()
  27. for pkg in pixbuf_pkgs:
  28. bb.note("adding pixbuf postinst and postrm scripts to %s" % pkg)
  29. postinst = d.getVar('pkg_postinst_%s' % pkg) or d.getVar('pkg_postinst')
  30. if not postinst:
  31. postinst = '#!/bin/sh\n'
  32. postinst += d.getVar('pixbufcache_common')
  33. d.setVar('pkg_postinst_%s' % pkg, postinst)
  34. postrm = d.getVar('pkg_postrm_%s' % pkg) or d.getVar('pkg_postrm')
  35. if not postrm:
  36. postrm = '#!/bin/sh\n'
  37. postrm += d.getVar('pixbufcache_common')
  38. d.setVar('pkg_postrm_%s' % pkg, postrm)
  39. }
  40. gdkpixbuf_complete() {
  41. GDK_PIXBUF_FATAL_LOADER=1 ${STAGING_LIBDIR_NATIVE}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders --update-cache || exit 1
  42. }
  43. DEPENDS_append_class-native = " gdk-pixbuf-native"
  44. SYSROOT_PREPROCESS_FUNCS_append_class-native = " pixbufcache_sstate_postinst"
  45. pixbufcache_sstate_postinst() {
  46. mkdir -p ${SYSROOT_DESTDIR}${bindir}
  47. dest=${SYSROOT_DESTDIR}${bindir}/postinst-${PN}
  48. echo '#!/bin/sh' > $dest
  49. echo "${gdkpixbuf_complete}" >> $dest
  50. chmod 0755 $dest
  51. }