blob: 8ebdfc4f5caf722f3f0a8ab8d0834a6b1f36b939 [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"
Patrick Williamsf1e5d692016-03-30 15:21:19 -050012FONTCONFIG_CACHE_PARAMS ?= "-v"
13# You can change this to e.g. FC_DEBUG=16 to debug fc-cache issues,
14# something has to be set, because qemuwrapper is using this variable after -E
15# multiple variables aren't allowed because for qemu they are separated
16# by comma and in -n "$D" case they should be separated by space
17FONTCONFIG_CACHE_ENV ?= "FC_DEBUG=1"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050018fontcache_common() {
Patrick Williamsf1e5d692016-03-30 15:21:19 -050019if [ -n "$D" ] ; then
20 $INTERCEPT_DIR/postinst_intercept update_font_cache ${PKG} mlprefix=${MLPREFIX} \
21 'bindir="${bindir}"' \
22 'libdir="${libdir}"' \
23 'base_libdir="${base_libdir}"' \
24 'fontconfigcachedir="${FONTCONFIG_CACHE_DIR}"' \
25 'fontconfigcacheparams="${FONTCONFIG_CACHE_PARAMS}"' \
26 'fontconfigcacheenv="${FONTCONFIG_CACHE_ENV}"'
Patrick Williamsc124f4f2015-09-15 14:41:29 -050027else
Patrick Williamsf1e5d692016-03-30 15:21:19 -050028 ${FONTCONFIG_CACHE_ENV} fc-cache ${FONTCONFIG_CACHE_PARAMS}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050029fi
30}
31
32python () {
33 font_pkgs = d.getVar('FONT_PACKAGES', True).split()
34 deps = d.getVar("FONT_EXTRA_RDEPENDS", True)
35
36 for pkg in font_pkgs:
37 if deps: d.appendVar('RDEPENDS_' + pkg, ' '+deps)
38}
39
40python add_fontcache_postinsts() {
41 for pkg in d.getVar('FONT_PACKAGES', True).split():
42 bb.note("adding fonts postinst and postrm scripts to %s" % pkg)
43 postinst = d.getVar('pkg_postinst_%s' % pkg, True) or d.getVar('pkg_postinst', True)
44 if not postinst:
45 postinst = '#!/bin/sh\n'
46 postinst += d.getVar('fontcache_common', True)
47 d.setVar('pkg_postinst_%s' % pkg, postinst)
48
49 postrm = d.getVar('pkg_postrm_%s' % pkg, True) or d.getVar('pkg_postrm', True)
50 if not postrm:
51 postrm = '#!/bin/sh\n'
52 postrm += d.getVar('fontcache_common', True)
53 d.setVar('pkg_postrm_%s' % pkg, postrm)
54}
55
56PACKAGEFUNCS =+ "add_fontcache_postinsts"