Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 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 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 5 | PACKAGE_WRITE_DEPS += "qemu-native" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 6 | |
| 7 | inherit qemu |
| 8 | |
| 9 | GTKIMMODULES_PACKAGES ?= "${PN}" |
| 10 | |
| 11 | gtk_immodule_cache_postinst() { |
| 12 | if [ "x$D" != "x" ]; then |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 13 | $INTERCEPT_DIR/postinst_intercept update_gtk_immodules_cache ${PKG} \ |
| 14 | mlprefix=${MLPREFIX} \ |
| 15 | binprefix=${MLPREFIX} \ |
| 16 | libdir=${libdir} \ |
| 17 | libexecdir=${libexecdir} \ |
| 18 | base_libdir=${base_libdir} \ |
| 19 | bindir=${bindir} |
| 20 | else |
| 21 | if [ ! -z `which gtk-query-immodules-2.0` ]; then |
| 22 | gtk-query-immodules-2.0 > ${libdir}/gtk-2.0/2.10.0/immodules.cache |
| 23 | fi |
| 24 | if [ ! -z `which gtk-query-immodules-3.0` ]; then |
| 25 | gtk-query-immodules-3.0 > ${libdir}/gtk-3.0/3.0.0/immodules.cache |
| 26 | fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 27 | fi |
| 28 | } |
| 29 | |
| 30 | gtk_immodule_cache_postrm() { |
| 31 | if [ "x$D" != "x" ]; then |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 32 | $INTERCEPT_DIR/postinst_intercept update_gtk_immodules_cache ${PKG} \ |
| 33 | mlprefix=${MLPREFIX} \ |
| 34 | binprefix=${MLPREFIX} \ |
| 35 | libdir=${libdir} \ |
| 36 | libexecdir=${libexecdir} \ |
| 37 | base_libdir=${base_libdir} \ |
| 38 | bindir=${bindir} |
| 39 | else |
| 40 | if [ ! -z `which gtk-query-immodules-2.0` ]; then |
| 41 | gtk-query-immodules-2.0 > ${libdir}/gtk-2.0/2.10.0/immodules.cache |
| 42 | fi |
| 43 | if [ ! -z `which gtk-query-immodules-3.0` ]; then |
| 44 | gtk-query-immodules-3.0 > ${libdir}/gtk-3.0/3.0.0/immodules.cache |
| 45 | fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 46 | fi |
| 47 | } |
| 48 | |
| 49 | python populate_packages_append () { |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 50 | gtkimmodules_pkgs = d.getVar('GTKIMMODULES_PACKAGES').split() |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 51 | |
| 52 | for pkg in gtkimmodules_pkgs: |
| 53 | bb.note("adding gtk-immodule-cache postinst and postrm scripts to %s" % pkg) |
| 54 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 55 | postinst = d.getVar('pkg_postinst_%s' % pkg) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 56 | if not postinst: |
| 57 | postinst = '#!/bin/sh\n' |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 58 | postinst += d.getVar('gtk_immodule_cache_postinst') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 59 | d.setVar('pkg_postinst_%s' % pkg, postinst) |
| 60 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 61 | postrm = d.getVar('pkg_postrm_%s' % pkg) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 62 | if not postrm: |
| 63 | postrm = '#!/bin/sh\n' |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 64 | postrm += d.getVar('gtk_immodule_cache_postrm') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 65 | d.setVar('pkg_postrm_%s' % pkg, postrm) |
| 66 | } |
| 67 | |
| 68 | python __anonymous() { |
| 69 | if not bb.data.inherits_class('native', d) and not bb.data.inherits_class('cross', d): |
| 70 | gtkimmodules_check = d.getVar('GTKIMMODULES_PACKAGES', False) |
| 71 | if not gtkimmodules_check: |
| 72 | bb_filename = d.getVar('FILE', False) |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 73 | bb.fatal("ERROR: %s inherits gtk-immodules-cache but doesn't set GTKIMMODULES_PACKAGES" % bb_filename) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 74 | } |
| 75 | |