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