| 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 |  | 
 | 6 | DEPENDS += "qemu-native" | 
 | 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 () { | 
 | 33 |     font_pkgs = d.getVar('FONT_PACKAGES', True).split() | 
 | 34 |     deps = d.getVar("FONT_EXTRA_RDEPENDS", True) | 
 | 35 |  | 
 | 36 |     for pkg in font_pkgs: | 
 | 37 |         if deps: d.appendVar('RDEPENDS_' + pkg, ' '+deps) | 
 | 38 | } | 
 | 39 |  | 
 | 40 | python add_fontcache_postinsts() { | 
 | 41 |     for pkg in d.getVar('FONT_PACKAGES', True).split(): | 
 | 42 |         bb.note("adding fonts postinst and postrm scripts to %s" % pkg) | 
 | 43 |         postinst = d.getVar('pkg_postinst_%s' % pkg, True) or d.getVar('pkg_postinst', True) | 
 | 44 |         if not postinst: | 
 | 45 |             postinst = '#!/bin/sh\n' | 
 | 46 |         postinst += d.getVar('fontcache_common', True) | 
 | 47 |         d.setVar('pkg_postinst_%s' % pkg, postinst) | 
 | 48 |  | 
 | 49 |         postrm = d.getVar('pkg_postrm_%s' % pkg, True) or d.getVar('pkg_postrm', True) | 
 | 50 |         if not postrm: | 
 | 51 |             postrm = '#!/bin/sh\n' | 
 | 52 |         postrm += d.getVar('fontcache_common', True) | 
 | 53 |         d.setVar('pkg_postrm_%s' % pkg, postrm) | 
 | 54 | } | 
 | 55 |  | 
 | 56 | PACKAGEFUNCS =+ "add_fontcache_postinsts" |