summaryrefslogtreecommitdiffstats
path: root/meta/classes/pixbufcache.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/pixbufcache.bbclass')
-rw-r--r--meta/classes/pixbufcache.bbclass72
1 files changed, 72 insertions, 0 deletions
diff --git a/meta/classes/pixbufcache.bbclass b/meta/classes/pixbufcache.bbclass
new file mode 100644
index 0000000000..b8d75bd38c
--- /dev/null
+++ b/meta/classes/pixbufcache.bbclass
@@ -0,0 +1,72 @@
1#
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
11pixbufcache_common() {
12if [ "x$D" != "x" ]; then
13 $INTERCEPT_DIR/postinst_intercept update_pixbuf_cache ${PKG} mlprefix=${MLPREFIX} libdir=${libdir} \
14 bindir=${bindir} base_libdir=${base_libdir}
15else
16
17 # Update the pixbuf loaders in case they haven't been registered yet
18 GDK_PIXBUF_MODULEDIR=${libdir}/gdk-pixbuf-2.0/2.10.0/loaders gdk-pixbuf-query-loaders --update-cache
19
20 if [ -x ${bindir}/gtk-update-icon-cache ] && [ -d ${datadir}/icons ]; then
21 for icondir in /usr/share/icons/*; do
22 if [ -d ${icondir} ]; then
23 gtk-update-icon-cache -t -q ${icondir}
24 fi
25 done
26 fi
27fi
28}
29
30python populate_packages_append() {
31 pixbuf_pkgs = d.getVar('PIXBUF_PACKAGES', True).split()
32
33 for pkg in pixbuf_pkgs:
34 bb.note("adding pixbuf postinst and postrm scripts to %s" % pkg)
35 postinst = d.getVar('pkg_postinst_%s' % pkg, True) or d.getVar('pkg_postinst', True)
36 if not postinst:
37 postinst = '#!/bin/sh\n'
38 postinst += d.getVar('pixbufcache_common', True)
39 d.setVar('pkg_postinst_%s' % pkg, postinst)
40
41 postrm = d.getVar('pkg_postrm_%s' % pkg, True) or d.getVar('pkg_postrm', True)
42 if not postrm:
43 postrm = '#!/bin/sh\n'
44 postrm += d.getVar('pixbufcache_common', True)
45 d.setVar('pkg_postrm_%s' % pkg, postrm)
46}
47
48#
49# Add an sstate postinst hook to update the cache for native packages.
50# An error exit during populate_sysroot_setscene allows bitbake to
51# try to recover by re-building the package.
52#
53SSTATEPOSTINSTFUNCS_append_class-native = " pixbufcache_sstate_postinst"
54
55pixbufcache_sstate_postinst() {
56 if [ "${BB_CURRENTTASK}" = "populate_sysroot" -o "${BB_CURRENTTASK}" = "populate_sysroot_setscene" ]
57 then
58 GDK_PIXBUF_FATAL_LOADER=1 gdk-pixbuf-query-loaders --update-cache || exit 1
59 fi
60}
61
62# Add all of the dependencies of gdk-pixbuf as dependencies of
63# do_populate_sysroot_setscene so that pixbufcache_sstate_postinst can work
64# (otherwise gdk-pixbuf-query-loaders may not exist or link). Only add
65# gdk-pixbuf-native if we're not building gdk-pixbuf itself.
66#
67# Packages that use this class should extend this variable with their runtime
68# dependencies.
69PIXBUFCACHE_SYSROOT_DEPS = ""
70PIXBUFCACHE_SYSROOT_DEPS_class-native = "${@['gdk-pixbuf-native:do_populate_sysroot_setscene', '']['${BPN}' == 'gdk-pixbuf']} glib-2.0-native:do_populate_sysroot_setscene libffi-native:do_populate_sysroot_setscene libpng-native:do_populate_sysroot_setscene zlib-native:do_populate_sysroot_setscene"
71do_populate_sysroot_setscene[depends] += "${PIXBUFCACHE_SYSROOT_DEPS}"
72do_populate_sysroot[depends] += "${@d.getVar('PIXBUFCACHE_SYSROOT_DEPS', True).replace('_setscene','')}"