blob: 13f9df1592ffe0f2de9f908fc9af83d944e88cc0 [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
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080020 $INTERCEPT_DIR/postinst_intercept update_font_cache ${PKG} mlprefix=${MLPREFIX} binprefix=${MLPREFIX} \
Patrick Williamsf1e5d692016-03-30 15:21:19 -050021 'bindir="${bindir}"' \
22 'libdir="${libdir}"' \
Brad Bishop19323692019-04-05 15:28:33 -040023 'libexecdir="${libexecdir}"' \
Patrick Williamsf1e5d692016-03-30 15:21:19 -050024 'base_libdir="${base_libdir}"' \
25 'fontconfigcachedir="${FONTCONFIG_CACHE_DIR}"' \
26 'fontconfigcacheparams="${FONTCONFIG_CACHE_PARAMS}"' \
27 'fontconfigcacheenv="${FONTCONFIG_CACHE_ENV}"'
Patrick Williamsc124f4f2015-09-15 14:41:29 -050028else
Patrick Williamsf1e5d692016-03-30 15:21:19 -050029 ${FONTCONFIG_CACHE_ENV} fc-cache ${FONTCONFIG_CACHE_PARAMS}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050030fi
31}
32
33python () {
Brad Bishop6e60e8b2018-02-01 10:27:11 -050034 font_pkgs = d.getVar('FONT_PACKAGES').split()
35 deps = d.getVar("FONT_EXTRA_RDEPENDS")
Patrick Williamsc124f4f2015-09-15 14:41:29 -050036
37 for pkg in font_pkgs:
38 if deps: d.appendVar('RDEPENDS_' + pkg, ' '+deps)
39}
40
41python add_fontcache_postinsts() {
Brad Bishop6e60e8b2018-02-01 10:27:11 -050042 for pkg in d.getVar('FONT_PACKAGES').split():
Patrick Williamsc124f4f2015-09-15 14:41:29 -050043 bb.note("adding fonts postinst and postrm scripts to %s" % pkg)
Brad Bishop6e60e8b2018-02-01 10:27:11 -050044 postinst = d.getVar('pkg_postinst_%s' % pkg) or d.getVar('pkg_postinst')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050045 if not postinst:
46 postinst = '#!/bin/sh\n'
Brad Bishop6e60e8b2018-02-01 10:27:11 -050047 postinst += d.getVar('fontcache_common')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050048 d.setVar('pkg_postinst_%s' % pkg, postinst)
49
Brad Bishop6e60e8b2018-02-01 10:27:11 -050050 postrm = d.getVar('pkg_postrm_%s' % pkg) or d.getVar('pkg_postrm')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050051 if not postrm:
52 postrm = '#!/bin/sh\n'
Brad Bishop6e60e8b2018-02-01 10:27:11 -050053 postrm += d.getVar('fontcache_common')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050054 d.setVar('pkg_postrm_%s' % pkg, postrm)
55}
56
57PACKAGEFUNCS =+ "add_fontcache_postinsts"