1# 2# Copyright OpenEmbedded Contributors 3# 4# SPDX-License-Identifier: MIT 5# 6 7# 8# This class will generate the proper postinst/postrm scriptlets for font 9# packages. 10# 11 12PACKAGE_WRITE_DEPS += "qemu-native" 13inherit qemu 14 15FONT_PACKAGES ??= "${PN}" 16FONT_PACKAGES:class-native = "" 17FONT_EXTRA_RDEPENDS ?= "${MLPREFIX}fontconfig-utils" 18FONTCONFIG_CACHE_DIR ?= "${localstatedir}/cache/fontconfig" 19FONTCONFIG_CACHE_PARAMS ?= "-v" 20# You can change this to e.g. FC_DEBUG=16 to debug fc-cache issues, 21# something has to be set, because qemuwrapper is using this variable after -E 22# multiple variables aren't allowed because for qemu they are separated 23# by comma and in -n "$D" case they should be separated by space 24FONTCONFIG_CACHE_ENV ?= "FC_DEBUG=1" 25fontcache_common() { 26if [ -n "$D" ] ; then 27 $INTERCEPT_DIR/postinst_intercept update_font_cache ${PKG} mlprefix=${MLPREFIX} binprefix=${MLPREFIX} \ 28 'bindir="${bindir}"' \ 29 'libdir="${libdir}"' \ 30 'libexecdir="${libexecdir}"' \ 31 'base_libdir="${base_libdir}"' \ 32 'fontconfigcachedir="${FONTCONFIG_CACHE_DIR}"' \ 33 'fontconfigcacheparams="${FONTCONFIG_CACHE_PARAMS}"' \ 34 'fontconfigcacheenv="${FONTCONFIG_CACHE_ENV}"' 35else 36 ${FONTCONFIG_CACHE_ENV} fc-cache ${FONTCONFIG_CACHE_PARAMS} 37fi 38} 39 40python () { 41 font_pkgs = d.getVar('FONT_PACKAGES').split() 42 deps = d.getVar("FONT_EXTRA_RDEPENDS") 43 44 for pkg in font_pkgs: 45 if deps: d.appendVar('RDEPENDS:' + pkg, ' '+deps) 46} 47 48python add_fontcache_postinsts() { 49 for pkg in d.getVar('FONT_PACKAGES').split(): 50 bb.note("adding fonts postinst and postrm scripts to %s" % pkg) 51 postinst = d.getVar('pkg_postinst:%s' % pkg) or d.getVar('pkg_postinst') 52 if not postinst: 53 postinst = '#!/bin/sh\n' 54 postinst += d.getVar('fontcache_common') 55 d.setVar('pkg_postinst:%s' % pkg, postinst) 56 57 postrm = d.getVar('pkg_postrm:%s' % pkg) or d.getVar('pkg_postrm') 58 if not postrm: 59 postrm = '#!/bin/sh\n' 60 postrm += d.getVar('fontcache_common') 61 d.setVar('pkg_postrm:%s' % pkg, postrm) 62} 63 64PACKAGEFUNCS =+ "add_fontcache_postinsts" 65