blob: d122387ffde8c313eed21d47c46ce12e968849ba [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001#
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}"
10FONT_EXTRA_RDEPENDS ?= "fontconfig-utils"
11FONTCONFIG_CACHE_DIR ?= "${localstatedir}/cache/fontconfig"
12fontcache_common() {
13if [ "x$D" != "x" ] ; then
14 $INTERCEPT_DIR/postinst_intercept update_font_cache ${PKG} mlprefix=${MLPREFIX} bindir=${bindir} \
15 libdir=${libdir} base_libdir=${base_libdir} fontconfigcachedir=${FONTCONFIG_CACHE_DIR}
16else
17 fc-cache
18fi
19}
20
21python () {
22 font_pkgs = d.getVar('FONT_PACKAGES', True).split()
23 deps = d.getVar("FONT_EXTRA_RDEPENDS", True)
24
25 for pkg in font_pkgs:
26 if deps: d.appendVar('RDEPENDS_' + pkg, ' '+deps)
27}
28
29python add_fontcache_postinsts() {
30 for pkg in d.getVar('FONT_PACKAGES', True).split():
31 bb.note("adding fonts postinst and postrm scripts to %s" % pkg)
32 postinst = d.getVar('pkg_postinst_%s' % pkg, True) or d.getVar('pkg_postinst', True)
33 if not postinst:
34 postinst = '#!/bin/sh\n'
35 postinst += d.getVar('fontcache_common', True)
36 d.setVar('pkg_postinst_%s' % pkg, postinst)
37
38 postrm = d.getVar('pkg_postrm_%s' % pkg, True) or d.getVar('pkg_postrm', True)
39 if not postrm:
40 postrm = '#!/bin/sh\n'
41 postrm += d.getVar('fontcache_common', True)
42 d.setVar('pkg_postrm_%s' % pkg, postrm)
43}
44
45PACKAGEFUNCS =+ "add_fontcache_postinsts"