summaryrefslogtreecommitdiffstats
path: root/meta/classes/fontcache.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/fontcache.bbclass')
-rw-r--r--meta/classes/fontcache.bbclass47
1 files changed, 47 insertions, 0 deletions
diff --git a/meta/classes/fontcache.bbclass b/meta/classes/fontcache.bbclass
new file mode 100644
index 0000000000..83817356c3
--- /dev/null
+++ b/meta/classes/fontcache.bbclass
@@ -0,0 +1,47 @@
1#
2# This class will generate the proper postinst/postrm scriptlets for font
3# packages.
4#
5
6DEPENDS += "qemu-native"
7inherit qemu
8
9FONT_PACKAGES ??= "${PN}"
10
11fontcache_common() {
12if [ "x$D" != "x" ] ; then
13 if [ ! -f $INTERCEPT_DIR/update_font_cache ]; then
14 cat << "EOF" > $INTERCEPT_DIR/update_font_cache
15#!/bin/sh
16
17${@qemu_run_binary(d, '$D', '/usr/bin/fc-cache')} --sysroot=$D >/dev/null 2>&1
18
19if [ $? -ne 0 ]; then
20 exit 1
21fi
22
23EOF
24 fi
25 exit 0
26fi
27
28fc-cache
29}
30
31python populate_packages_append() {
32 font_pkgs = d.getVar('FONT_PACKAGES', True).split()
33
34 for pkg in font_pkgs:
35 bb.note("adding fonts postinst and postrm scripts to %s" % pkg)
36 postinst = d.getVar('pkg_postinst_%s' % pkg, True) or d.getVar('pkg_postinst', True)
37 if not postinst:
38 postinst = '#!/bin/sh\n'
39 postinst += d.getVar('fontcache_common', True)
40 d.setVar('pkg_postinst_%s' % pkg, postinst)
41
42 postrm = d.getVar('pkg_postrm_%s' % pkg, True) or d.getVar('pkg_postrm', True)
43 if not postrm:
44 postrm = '#!/bin/sh\n'
45 postrm += d.getVar('fontcache_common', True)
46 d.setVar('pkg_postrm_%s' % pkg, postrm)
47}