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