xref: /OK3568_Linux_fs/yocto/poky/meta/classes/pixbufcache.bbclass (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1#
2# This class will generate the proper postinst/postrm scriptlets for pixbuf
3# packages.
4#
5
6DEPENDS:append:class-target = " qemu-native"
7inherit qemu
8
9PIXBUF_PACKAGES ??= "${PN}"
10
11PACKAGE_WRITE_DEPS += "qemu-native gdk-pixbuf-native"
12
13pixbufcache_common() {
14if [ "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}
17else
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
29fi
30}
31
32python 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
50gdkpixbuf_complete() {
51GDK_PIXBUF_FATAL_LOADER=1 ${STAGING_LIBDIR_NATIVE}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders --update-cache || exit 1
52}
53
54DEPENDS:append:class-native = " gdk-pixbuf-native"
55SYSROOT_PREPROCESS_FUNCS:append:class-native = " pixbufcache_sstate_postinst"
56
57pixbufcache_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}
64