blob: 3378ff2c8061d6b9f8daeed4147bbcae511a1b90 [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
6DEPENDS += "qemu-native"
7inherit 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
32python 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)
Brad Bishop6e60e8b2018-02-01 10:27:11 -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 Williamsc124f4f2015-09-15 14:41:29 -050041 d.setVar('pkg_postinst_%s' % pkg, postinst)
42
Brad Bishop6e60e8b2018-02-01 10:27:11 -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 Williamsc124f4f2015-09-15 14:41:29 -050047 d.setVar('pkg_postrm_%s' % pkg, postrm)
48}
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 Williamsc0f7c042017-02-23 20:41:17 -060054DEPENDS_append_class-native = " gdk-pixbuf-native"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050055SYSROOT_PREPROCESS_FUNCS_append_class-native = " pixbufcache_sstate_postinst"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050056
57# See base.bbclass for the other half of this
58pixbufcache_sstate_postinst() {
Brad Bishop6e60e8b2018-02-01 10:27:11 -050059 mkdir -p ${SYSROOT_DESTDIR}${bindir}
60 dest=${SYSROOT_DESTDIR}${bindir}/postinst-${PN}
61 echo '#!/bin/sh' > $dest
62 echo "${gdkpixbuf_complete}" >> $dest
63 chmod 0755 $dest
Patrick Williamsc124f4f2015-09-15 14:41:29 -050064}