blob: 97e7f17f00e47389182d09522042ed19c2cbf626 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001#
2# This class will generate the proper postinst/postrm scriptlets for font
3# packages.
4#
5
6PACKAGE_WRITE_DEPS += "qemu-native"
7inherit qemu
8
9FONT_PACKAGES ??= "${PN}"
10FONT_EXTRA_RDEPENDS ?= "fontconfig-utils"
11FONTCONFIG_CACHE_DIR ?= "${localstatedir}/cache/fontconfig"
12FONTCONFIG_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"
18fontcache_common() {
19if [ -n "$D" ] ; then
20 $INTERCEPT_DIR/postinst_intercept update_font_cache ${PKG} mlprefix=${MLPREFIX} binprefix=${MLPREFIX} \
21 'bindir="${bindir}"' \
22 'libdir="${libdir}"' \
23 'libexecdir="${libexecdir}"' \
24 'base_libdir="${base_libdir}"' \
25 'fontconfigcachedir="${FONTCONFIG_CACHE_DIR}"' \
26 'fontconfigcacheparams="${FONTCONFIG_CACHE_PARAMS}"' \
27 'fontconfigcacheenv="${FONTCONFIG_CACHE_ENV}"'
28else
29 ${FONTCONFIG_CACHE_ENV} fc-cache ${FONTCONFIG_CACHE_PARAMS}
30fi
31}
32
33python () {
34 font_pkgs = d.getVar('FONT_PACKAGES').split()
35 deps = d.getVar("FONT_EXTRA_RDEPENDS")
36
37 for pkg in font_pkgs:
38 if deps: d.appendVar('RDEPENDS_' + pkg, ' '+deps)
39}
40
41python add_fontcache_postinsts() {
42 for pkg in d.getVar('FONT_PACKAGES').split():
43 bb.note("adding fonts postinst and postrm scripts to %s" % pkg)
44 postinst = d.getVar('pkg_postinst_%s' % pkg) or d.getVar('pkg_postinst')
45 if not postinst:
46 postinst = '#!/bin/sh\n'
47 postinst += d.getVar('fontcache_common')
48 d.setVar('pkg_postinst_%s' % pkg, postinst)
49
50 postrm = d.getVar('pkg_postrm_%s' % pkg) or d.getVar('pkg_postrm')
51 if not postrm:
52 postrm = '#!/bin/sh\n'
53 postrm += d.getVar('fontcache_common')
54 d.setVar('pkg_postrm_%s' % pkg, postrm)
55}
56
57PACKAGEFUNCS =+ "add_fontcache_postinsts"