Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | # |
| 2 | # This class will generate the proper postinst/postrm scriptlets for font |
| 3 | # packages. |
| 4 | # |
| 5 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 6 | PACKAGE_WRITE_DEPS += "qemu-native" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 7 | inherit qemu |
| 8 | |
| 9 | FONT_PACKAGES ??= "${PN}" |
Andrew Geissler | 1e34c2d | 2020-05-29 16:02:59 -0500 | [diff] [blame] | 10 | FONT_EXTRA_RDEPENDS ?= "${MLPREFIX}fontconfig-utils" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 11 | FONTCONFIG_CACHE_DIR ?= "${localstatedir}/cache/fontconfig" |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 12 | FONTCONFIG_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 |
| 17 | FONTCONFIG_CACHE_ENV ?= "FC_DEBUG=1" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 18 | fontcache_common() { |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 19 | if [ -n "$D" ] ; then |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 20 | $INTERCEPT_DIR/postinst_intercept update_font_cache ${PKG} mlprefix=${MLPREFIX} binprefix=${MLPREFIX} \ |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 21 | 'bindir="${bindir}"' \ |
| 22 | 'libdir="${libdir}"' \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 23 | 'libexecdir="${libexecdir}"' \ |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 24 | 'base_libdir="${base_libdir}"' \ |
| 25 | 'fontconfigcachedir="${FONTCONFIG_CACHE_DIR}"' \ |
| 26 | 'fontconfigcacheparams="${FONTCONFIG_CACHE_PARAMS}"' \ |
| 27 | 'fontconfigcacheenv="${FONTCONFIG_CACHE_ENV}"' |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 28 | else |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 29 | ${FONTCONFIG_CACHE_ENV} fc-cache ${FONTCONFIG_CACHE_PARAMS} |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 30 | fi |
| 31 | } |
| 32 | |
| 33 | python () { |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 34 | font_pkgs = d.getVar('FONT_PACKAGES').split() |
| 35 | deps = d.getVar("FONT_EXTRA_RDEPENDS") |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 36 | |
| 37 | for pkg in font_pkgs: |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame^] | 38 | if deps: d.appendVar('RDEPENDS:' + pkg, ' '+deps) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 39 | } |
| 40 | |
| 41 | python add_fontcache_postinsts() { |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 42 | for pkg in d.getVar('FONT_PACKAGES').split(): |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 43 | bb.note("adding fonts postinst and postrm scripts to %s" % pkg) |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame^] | 44 | postinst = d.getVar('pkg_postinst:%s' % pkg) or d.getVar('pkg_postinst') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 45 | if not postinst: |
| 46 | postinst = '#!/bin/sh\n' |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 47 | postinst += d.getVar('fontcache_common') |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame^] | 48 | d.setVar('pkg_postinst:%s' % pkg, postinst) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 49 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame^] | 50 | postrm = d.getVar('pkg_postrm:%s' % pkg) or d.getVar('pkg_postrm') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 51 | if not postrm: |
| 52 | postrm = '#!/bin/sh\n' |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 53 | postrm += d.getVar('fontcache_common') |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame^] | 54 | d.setVar('pkg_postrm:%s' % pkg, postrm) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 55 | } |
| 56 | |
| 57 | PACKAGEFUNCS =+ "add_fontcache_postinsts" |