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}" |
| 10 | FONT_EXTRA_RDEPENDS ?= "fontconfig-utils" |
| 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 |
| 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 Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 27 | else |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 28 | ${FONTCONFIG_CACHE_ENV} fc-cache ${FONTCONFIG_CACHE_PARAMS} |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 29 | fi |
| 30 | } |
| 31 | |
| 32 | python () { |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 33 | font_pkgs = d.getVar('FONT_PACKAGES').split() |
| 34 | deps = d.getVar("FONT_EXTRA_RDEPENDS") |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 35 | |
| 36 | for pkg in font_pkgs: |
| 37 | if deps: d.appendVar('RDEPENDS_' + pkg, ' '+deps) |
| 38 | } |
| 39 | |
| 40 | python add_fontcache_postinsts() { |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 41 | for pkg in d.getVar('FONT_PACKAGES').split(): |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 42 | bb.note("adding fonts postinst and postrm scripts to %s" % pkg) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 43 | postinst = d.getVar('pkg_postinst_%s' % pkg) or d.getVar('pkg_postinst') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 44 | if not postinst: |
| 45 | postinst = '#!/bin/sh\n' |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 46 | postinst += d.getVar('fontcache_common') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 47 | d.setVar('pkg_postinst_%s' % pkg, postinst) |
| 48 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 49 | postrm = d.getVar('pkg_postrm_%s' % pkg) or d.getVar('pkg_postrm') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 50 | if not postrm: |
| 51 | postrm = '#!/bin/sh\n' |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 52 | postrm += d.getVar('fontcache_common') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 53 | d.setVar('pkg_postrm_%s' % pkg, postrm) |
| 54 | } |
| 55 | |
| 56 | PACKAGEFUNCS =+ "add_fontcache_postinsts" |