diff options
Diffstat (limited to 'meta')
-rw-r--r-- | meta/classes/gtk-immodules-cache.bbclass | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/meta/classes/gtk-immodules-cache.bbclass b/meta/classes/gtk-immodules-cache.bbclass new file mode 100644 index 0000000000..515d28b5b4 --- /dev/null +++ b/meta/classes/gtk-immodules-cache.bbclass | |||
@@ -0,0 +1,55 @@ | |||
1 | # This class will update the inputmethod module cache for virtual keyboards | ||
2 | # | ||
3 | # Usage: Set GTKIMMODULES_PACKAGES to the packages that needs to update the inputmethod modules | ||
4 | |||
5 | gtk_immodule_cache_postinst() { | ||
6 | if [ "x$D" != "x" ]; then | ||
7 | exit 1 | ||
8 | fi | ||
9 | if [ ! -z `which gtk-query-immodules-2.0` ]; then | ||
10 | gtk-query-immodules-2.0 > /etc/gtk-2.0/gtk.immodules | ||
11 | fi | ||
12 | if [ ! -z `which gtk-query-immodules-3.0` ]; then | ||
13 | gtk-query-immodules-3.0 > /etc/gtk-3.0/gtk.immodules | ||
14 | fi | ||
15 | } | ||
16 | |||
17 | gtk_immodule_cache_postrm() { | ||
18 | if [ "x$D" != "x" ]; then | ||
19 | exit 1 | ||
20 | fi | ||
21 | if [ ! -z `which gtk-query-immodules-2.0` ]; then | ||
22 | gtk-query-immodules-2.0 > /etc/gtk-2.0/gtk.immodules | ||
23 | fi | ||
24 | if [ ! -z `which gtk-query-immodules-3.0` ]; then | ||
25 | gtk-query-immodules-3.0 > /etc/gtk-3.0/gtk.immodules | ||
26 | fi | ||
27 | } | ||
28 | |||
29 | python populate_packages_append () { | ||
30 | gtkimmodules_pkgs = d.getVar('GTKIMMODULES_PACKAGES', True).split() | ||
31 | |||
32 | for pkg in gtkimmodules_pkgs: | ||
33 | bb.note("adding gtk-immodule-cache postinst and postrm scripts to %s" % pkg) | ||
34 | |||
35 | postinst = d.getVar('pkg_postinst_%s' % pkg, True) or d.getVar('pkg_postinst', True) | ||
36 | if not postinst: | ||
37 | postinst = '#!/bin/sh\n' | ||
38 | postinst += d.getVar('gtk_immodule_cache_postinst', True) | ||
39 | d.setVar('pkg_postinst_%s' % pkg, postinst) | ||
40 | |||
41 | postrm = d.getVar('pkg_postrm_%s' % pkg, True) or d.getVar('pkg_postrm', True) | ||
42 | if not postrm: | ||
43 | postrm = '#!/bin/sh\n' | ||
44 | postrm += d.getVar('gtk_immodule_cache_postrm', True) | ||
45 | d.setVar('pkg_postrm_%s' % pkg, postrm) | ||
46 | } | ||
47 | |||
48 | python __anonymous() { | ||
49 | if not bb.data.inherits_class('native', d) and not bb.data.inherits_class('cross', d): | ||
50 | gtkimmodules_check = d.getVar('GTKIMMODULES_PACKAGES') | ||
51 | if not gtkimmodules_check: | ||
52 | bb_filename = d.getVar('FILE') | ||
53 | raise bb.build.FuncFailed, "\n\n\nERROR: %s inherits gtk-immodule-cache but doesn't set GTKIMMODULES_PACKAGE" % bb_filename | ||
54 | } | ||
55 | |||