Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | # |
| 2 | # This class will generate the proper postinst/postrm scriptlets for pixbuf |
| 3 | # packages. |
| 4 | # |
| 5 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 6 | DEPENDS:append:class-target = " qemu-native" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 7 | inherit qemu |
| 8 | |
| 9 | PIXBUF_PACKAGES ??= "${PN}" |
| 10 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 11 | PACKAGE_WRITE_DEPS += "qemu-native gdk-pixbuf-native" |
| 12 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 13 | pixbufcache_common() { |
| 14 | if [ "x$D" != "x" ]; then |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 15 | $INTERCEPT_DIR/postinst_intercept update_pixbuf_cache ${PKG} mlprefix=${MLPREFIX} binprefix=${MLPREFIX} libdir=${libdir} \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 16 | bindir=${bindir} base_libdir=${base_libdir} |
| 17 | else |
| 18 | |
| 19 | # Update the pixbuf loaders in case they haven't been registered yet |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 20 | ${libdir}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders --update-cache |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 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 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 32 | python populate_packages:append() { |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 33 | pixbuf_pkgs = d.getVar('PIXBUF_PACKAGES').split() |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 34 | |
| 35 | for pkg in pixbuf_pkgs: |
| 36 | bb.note("adding pixbuf postinst and postrm scripts to %s" % pkg) |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 37 | postinst = d.getVar('pkg_postinst:%s' % pkg) or d.getVar('pkg_postinst') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 38 | if not postinst: |
| 39 | postinst = '#!/bin/sh\n' |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 40 | postinst += d.getVar('pixbufcache_common') |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 41 | d.setVar('pkg_postinst:%s' % pkg, postinst) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 42 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 43 | postrm = d.getVar('pkg_postrm:%s' % pkg) or d.getVar('pkg_postrm') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 44 | if not postrm: |
| 45 | postrm = '#!/bin/sh\n' |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 46 | postrm += d.getVar('pixbufcache_common') |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 47 | d.setVar('pkg_postrm:%s' % pkg, postrm) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 48 | } |
| 49 | |
| 50 | gdkpixbuf_complete() { |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 51 | GDK_PIXBUF_FATAL_LOADER=1 ${STAGING_LIBDIR_NATIVE}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders --update-cache || exit 1 |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 52 | } |
| 53 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 54 | DEPENDS:append:class-native = " gdk-pixbuf-native" |
| 55 | SYSROOT_PREPROCESS_FUNCS:append:class-native = " pixbufcache_sstate_postinst" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 56 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 57 | pixbufcache_sstate_postinst() { |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 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 |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 63 | } |