blob: 886bf195b329c03fbaf9bd3b1b99eaf142dff8fc [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001#
2# This class will generate the proper postinst/postrm scriptlets for pixbuf
3# packages.
4#
5
Patrick Williams213cb262021-08-07 19:21:33 -05006DEPENDS:append:class-target = " qemu-native"
Patrick Williamsc124f4f2015-09-15 14:41:29 -05007inherit qemu
8
9PIXBUF_PACKAGES ??= "${PN}"
10
Brad Bishop6e60e8b2018-02-01 10:27:11 -050011PACKAGE_WRITE_DEPS += "qemu-native gdk-pixbuf-native"
12
Patrick Williamsc124f4f2015-09-15 14:41:29 -050013pixbufcache_common() {
14if [ "x$D" != "x" ]; then
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080015 $INTERCEPT_DIR/postinst_intercept update_pixbuf_cache ${PKG} mlprefix=${MLPREFIX} binprefix=${MLPREFIX} libdir=${libdir} \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050016 bindir=${bindir} base_libdir=${base_libdir}
17else
18
19 # Update the pixbuf loaders in case they haven't been registered yet
Patrick Williamsf1e5d692016-03-30 15:21:19 -050020 ${libdir}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders --update-cache
Patrick Williamsc124f4f2015-09-15 14:41:29 -050021
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
29fi
30}
31
Patrick Williams213cb262021-08-07 19:21:33 -050032python populate_packages:append() {
Brad Bishop6e60e8b2018-02-01 10:27:11 -050033 pixbuf_pkgs = d.getVar('PIXBUF_PACKAGES').split()
Patrick Williamsc124f4f2015-09-15 14:41:29 -050034
35 for pkg in pixbuf_pkgs:
36 bb.note("adding pixbuf postinst and postrm scripts to %s" % pkg)
Patrick Williams213cb262021-08-07 19:21:33 -050037 postinst = d.getVar('pkg_postinst:%s' % pkg) or d.getVar('pkg_postinst')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050038 if not postinst:
39 postinst = '#!/bin/sh\n'
Brad Bishop6e60e8b2018-02-01 10:27:11 -050040 postinst += d.getVar('pixbufcache_common')
Patrick Williams213cb262021-08-07 19:21:33 -050041 d.setVar('pkg_postinst:%s' % pkg, postinst)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050042
Patrick Williams213cb262021-08-07 19:21:33 -050043 postrm = d.getVar('pkg_postrm:%s' % pkg) or d.getVar('pkg_postrm')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050044 if not postrm:
45 postrm = '#!/bin/sh\n'
Brad Bishop6e60e8b2018-02-01 10:27:11 -050046 postrm += d.getVar('pixbufcache_common')
Patrick Williams213cb262021-08-07 19:21:33 -050047 d.setVar('pkg_postrm:%s' % pkg, postrm)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050048}
49
50gdkpixbuf_complete() {
Brad Bishop6e60e8b2018-02-01 10:27:11 -050051GDK_PIXBUF_FATAL_LOADER=1 ${STAGING_LIBDIR_NATIVE}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders --update-cache || exit 1
Patrick Williamsc124f4f2015-09-15 14:41:29 -050052}
53
Patrick Williams213cb262021-08-07 19:21:33 -050054DEPENDS:append:class-native = " gdk-pixbuf-native"
55SYSROOT_PREPROCESS_FUNCS:append:class-native = " pixbufcache_sstate_postinst"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050056
Patrick Williamsc124f4f2015-09-15 14:41:29 -050057pixbufcache_sstate_postinst() {
Brad Bishop6e60e8b2018-02-01 10:27:11 -050058 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 Williamsc124f4f2015-09-15 14:41:29 -050063}