blob: e76331131ee4438003d3569366594fe436215bf6 [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
Brad Bishop6e60e8b2018-02-01 10:27:11 -05006PACKAGE_WRITE_DEPS += "qemu-native"
Patrick Williamsc124f4f2015-09-15 14:41:29 -05007inherit 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 () {
Brad Bishop6e60e8b2018-02-01 10:27:11 -050033 font_pkgs = d.getVar('FONT_PACKAGES').split()
34 deps = d.getVar("FONT_EXTRA_RDEPENDS")
Patrick Williamsc124f4f2015-09-15 14:41:29 -050035
36 for pkg in font_pkgs:
37 if deps: d.appendVar('RDEPENDS_' + pkg, ' '+deps)
38}
39
40python add_fontcache_postinsts() {
Brad Bishop6e60e8b2018-02-01 10:27:11 -050041 for pkg in d.getVar('FONT_PACKAGES').split():
Patrick Williamsc124f4f2015-09-15 14:41:29 -050042 bb.note("adding fonts postinst and postrm scripts to %s" % pkg)
Brad Bishop6e60e8b2018-02-01 10:27:11 -050043 postinst = d.getVar('pkg_postinst_%s' % pkg) or d.getVar('pkg_postinst')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050044 if not postinst:
45 postinst = '#!/bin/sh\n'
Brad Bishop6e60e8b2018-02-01 10:27:11 -050046 postinst += d.getVar('fontcache_common')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050047 d.setVar('pkg_postinst_%s' % pkg, postinst)
48
Brad Bishop6e60e8b2018-02-01 10:27:11 -050049 postrm = d.getVar('pkg_postrm_%s' % pkg) or d.getVar('pkg_postrm')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050050 if not postrm:
51 postrm = '#!/bin/sh\n'
Brad Bishop6e60e8b2018-02-01 10:27:11 -050052 postrm += d.getVar('fontcache_common')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050053 d.setVar('pkg_postrm_%s' % pkg, postrm)
54}
55
56PACKAGEFUNCS =+ "add_fontcache_postinsts"