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.bbclass70
1 files changed, 70 insertions, 0 deletions
diff --git a/meta/classes/pixbufcache.bbclass b/meta/classes/pixbufcache.bbclass
new file mode 100644
index 0000000..922174d
--- /dev/null
+++ b/meta/classes/pixbufcache.bbclass
@@ -0,0 +1,70 @@
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 a sstate postinst hook to update the cache for native packages
50#
51SSTATEPOSTINSTFUNCS_append_class-native = " pixbufcache_sstate_postinst"
52
53pixbufcache_sstate_postinst() {
54 if [ "${BB_CURRENTTASK}" = "populate_sysroot" -o "${BB_CURRENTTASK}" = "populate_sysroot_setscene" ]
55 then
56 GDK_PIXBUF_FATAL_LOADER=1 gdk-pixbuf-query-loaders --update-cache
57 fi
58}
59
60# Add all of the dependencies of gdk-pixbuf as dependencies of
61# do_populate_sysroot_setscene so that pixbufcache_sstate_postinst can work
62# (otherwise gdk-pixbuf-query-loaders may not exist or link). Only add
63# gdk-pixbuf-native if we're not building gdk-pixbuf itself.
64#
65# Packages that use this class should extend this variable with their runtime
66# dependencies.
67PIXBUFCACHE_SYSROOT_DEPS = ""
68PIXBUFCACHE_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"
69do_populate_sysroot_setscene[depends] += "${PIXBUFCACHE_SYSROOT_DEPS}"
70do_populate_sysroot[depends] += "${@d.getVar('PIXBUFCACHE_SYSROOT_DEPS', True).replace('_setscene','')}"