diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-08-10 14:35:29 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-08-12 15:27:17 +0100 |
commit | fd1517e2b51a170f2427122c6b95396db251d827 (patch) | |
tree | dabfe3e631339c2fc99a9ee7febb0f9c128e325e /meta/classes-recipe/fontcache.bbclass | |
parent | 10317912ee319ccf7f83605d438b5cbf9663f296 (diff) | |
download | poky-fd1517e2b51a170f2427122c6b95396db251d827.tar.gz |
classes: Update classes to match new bitbake class scope functionality
Move classes to classes-global or classes-recipe as appropriate to take
advantage of new bitbake functionality to check class scope/usage.
(From OE-Core rev: f5c128008365e141082c129417eb72d2751e8045)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes-recipe/fontcache.bbclass')
-rw-r--r-- | meta/classes-recipe/fontcache.bbclass | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/meta/classes-recipe/fontcache.bbclass b/meta/classes-recipe/fontcache.bbclass new file mode 100644 index 0000000000..0d496b72dd --- /dev/null +++ b/meta/classes-recipe/fontcache.bbclass | |||
@@ -0,0 +1,63 @@ | |||
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 | |||
12 | PACKAGE_WRITE_DEPS += "qemu-native" | ||
13 | inherit qemu | ||
14 | |||
15 | FONT_PACKAGES ??= "${PN}" | ||
16 | FONT_EXTRA_RDEPENDS ?= "${MLPREFIX}fontconfig-utils" | ||
17 | FONTCONFIG_CACHE_DIR ?= "${localstatedir}/cache/fontconfig" | ||
18 | FONTCONFIG_CACHE_PARAMS ?= "-v" | ||
19 | # You can change this to e.g. FC_DEBUG=16 to debug fc-cache issues, | ||
20 | # something has to be set, because qemuwrapper is using this variable after -E | ||
21 | # multiple variables aren't allowed because for qemu they are separated | ||
22 | # by comma and in -n "$D" case they should be separated by space | ||
23 | FONTCONFIG_CACHE_ENV ?= "FC_DEBUG=1" | ||
24 | fontcache_common() { | ||
25 | if [ -n "$D" ] ; then | ||
26 | $INTERCEPT_DIR/postinst_intercept update_font_cache ${PKG} mlprefix=${MLPREFIX} binprefix=${MLPREFIX} \ | ||
27 | 'bindir="${bindir}"' \ | ||
28 | 'libdir="${libdir}"' \ | ||
29 | 'libexecdir="${libexecdir}"' \ | ||
30 | 'base_libdir="${base_libdir}"' \ | ||
31 | 'fontconfigcachedir="${FONTCONFIG_CACHE_DIR}"' \ | ||
32 | 'fontconfigcacheparams="${FONTCONFIG_CACHE_PARAMS}"' \ | ||
33 | 'fontconfigcacheenv="${FONTCONFIG_CACHE_ENV}"' | ||
34 | else | ||
35 | ${FONTCONFIG_CACHE_ENV} fc-cache ${FONTCONFIG_CACHE_PARAMS} | ||
36 | fi | ||
37 | } | ||
38 | |||
39 | python () { | ||
40 | font_pkgs = d.getVar('FONT_PACKAGES').split() | ||
41 | deps = d.getVar("FONT_EXTRA_RDEPENDS") | ||
42 | |||
43 | for pkg in font_pkgs: | ||
44 | if deps: d.appendVar('RDEPENDS:' + pkg, ' '+deps) | ||
45 | } | ||
46 | |||
47 | python add_fontcache_postinsts() { | ||
48 | for pkg in d.getVar('FONT_PACKAGES').split(): | ||
49 | bb.note("adding fonts postinst and postrm scripts to %s" % pkg) | ||
50 | postinst = d.getVar('pkg_postinst:%s' % pkg) or d.getVar('pkg_postinst') | ||
51 | if not postinst: | ||
52 | postinst = '#!/bin/sh\n' | ||
53 | postinst += d.getVar('fontcache_common') | ||
54 | d.setVar('pkg_postinst:%s' % pkg, postinst) | ||
55 | |||
56 | postrm = d.getVar('pkg_postrm:%s' % pkg) or d.getVar('pkg_postrm') | ||
57 | if not postrm: | ||
58 | postrm = '#!/bin/sh\n' | ||
59 | postrm += d.getVar('fontcache_common') | ||
60 | d.setVar('pkg_postrm:%s' % pkg, postrm) | ||
61 | } | ||
62 | |||
63 | PACKAGEFUNCS =+ "add_fontcache_postinsts" | ||