blob: 91cb4ad4090a9ff9670cdceba5edb46a6ac3d596 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001FILES_${PN} += "${datadir}/icons/hicolor"
2
3DEPENDS +=" ${@['hicolor-icon-theme', '']['${BPN}' == 'hicolor-icon-theme']} gtk+3-native"
4
5PACKAGE_WRITE_DEPS += "gtk+3-native gdk-pixbuf-native"
6
7gtk_icon_cache_postinst() {
8if [ "x$D" != "x" ]; then
9 $INTERCEPT_DIR/postinst_intercept update_gtk_icon_cache ${PKG} \
10 mlprefix=${MLPREFIX} \
11 libdir_native=${libdir_native}
12else
13
14 # Update the pixbuf loaders in case they haven't been registered yet
15 ${libdir}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders --update-cache
16
17 for icondir in /usr/share/icons/* ; do
18 if [ -d $icondir ] ; then
19 gtk-update-icon-cache -fqt $icondir
20 fi
21 done
22fi
23}
24
25gtk_icon_cache_postrm() {
26if [ "x$D" != "x" ]; then
27 $INTERCEPT_DIR/postinst_intercept update_gtk_icon_cache ${PKG} \
28 mlprefix=${MLPREFIX} \
29 libdir=${libdir}
30else
31 for icondir in /usr/share/icons/* ; do
32 if [ -d $icondir ] ; then
33 gtk-update-icon-cache -qt $icondir
34 fi
35 done
36fi
37}
38
39python populate_packages_append () {
40 packages = d.getVar('PACKAGES').split()
41 pkgdest = d.getVar('PKGDEST')
42
43 for pkg in packages:
44 icon_dir = '%s/%s/%s/icons' % (pkgdest, pkg, d.getVar('datadir'))
45 if not os.path.exists(icon_dir):
46 continue
47
48 bb.note("adding hicolor-icon-theme dependency to %s" % pkg)
49 rdepends = ' ' + d.getVar('MLPREFIX', False) + "hicolor-icon-theme"
50 d.appendVar('RDEPENDS_%s' % pkg, rdepends)
51
52 bb.note("adding gtk-icon-cache postinst and postrm scripts to %s" % pkg)
53
54 postinst = d.getVar('pkg_postinst_%s' % pkg)
55 if not postinst:
56 postinst = '#!/bin/sh\n'
57 postinst += d.getVar('gtk_icon_cache_postinst')
58 d.setVar('pkg_postinst_%s' % pkg, postinst)
59
60 postrm = d.getVar('pkg_postrm_%s' % pkg)
61 if not postrm:
62 postrm = '#!/bin/sh\n'
63 postrm += d.getVar('gtk_icon_cache_postrm')
64 d.setVar('pkg_postrm_%s' % pkg, postrm)
65}
66