diff options
| author | Samuel Stirtzel <s.stirtzel@googlemail.com> | 2012-10-18 09:32:47 +0200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-10-24 12:50:45 +0100 |
| commit | 54d42c1427afb97b783cab65e1126c1bfa778ddf (patch) | |
| tree | 4643ee39cdf76a319b15af553dd9563e9c95ec46 | |
| parent | dfc39d7bd5a9ad803d7c44b21811881515f7de02 (diff) | |
| download | poky-54d42c1427afb97b783cab65e1126c1bfa778ddf.tar.gz | |
gtk-immodules-cache: Add initial class to update gtk inputmethod module cache
This is used by:
openembedded-core/meta/recipes-sato/matchbox-keyboard/matchbox-keyboard_git.bb
meta-openembedded/meta-oe/recipes-support/maliit/maliit-framework_git.bb
(From OE-Core rev: c67f64e5846bb2a6774e61a4f3719c5f82fc3bd8)
Signed-off-by: Samuel Stirtzel <s.stirtzel@googlemail.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -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 | |||
