blob: d87167aec097acb99eef6fe5f0477e3792c9b5af [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001FILES_${PN} += "${datadir}/icons/hicolor"
2
3DEPENDS += "${@['hicolor-icon-theme', '']['${BPN}' == 'hicolor-icon-theme']} gtk-icon-utils-native"
4
Brad Bishop6e60e8b2018-02-01 10:27:11 -05005PACKAGE_WRITE_DEPS += "gtk-icon-utils-native gdk-pixbuf-native"
6
Patrick Williamsc124f4f2015-09-15 14:41:29 -05007gtk_icon_cache_postinst() {
8if [ "x$D" != "x" ]; then
Patrick Williamsf1e5d692016-03-30 15:21:19 -05009 $INTERCEPT_DIR/postinst_intercept update_icon_cache ${PKG} \
10 mlprefix=${MLPREFIX} \
11 libdir_native=${libdir_native}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050012else
13
14 # Update the pixbuf loaders in case they haven't been registered yet
Patrick Williamsf1e5d692016-03-30 15:21:19 -050015 ${libdir}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders --update-cache
Patrick Williamsc124f4f2015-09-15 14:41:29 -050016
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
Patrick Williamsf1e5d692016-03-30 15:21:19 -050027 $INTERCEPT_DIR/postinst_intercept update_icon_cache ${PKG} \
28 mlprefix=${MLPREFIX} \
29 libdir=${libdir}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050030else
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 () {
Brad Bishop6e60e8b2018-02-01 10:27:11 -050040 packages = d.getVar('PACKAGES').split()
41 pkgdest = d.getVar('PKGDEST')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050042
43 for pkg in packages:
Brad Bishop6e60e8b2018-02-01 10:27:11 -050044 icon_dir = '%s/%s/%s/icons' % (pkgdest, pkg, d.getVar('datadir'))
Patrick Williamsc124f4f2015-09-15 14:41:29 -050045 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
Brad Bishop6e60e8b2018-02-01 10:27:11 -050054 postinst = d.getVar('pkg_postinst_%s' % pkg)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050055 if not postinst:
56 postinst = '#!/bin/sh\n'
Brad Bishop6e60e8b2018-02-01 10:27:11 -050057 postinst += d.getVar('gtk_icon_cache_postinst')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050058 d.setVar('pkg_postinst_%s' % pkg, postinst)
59
Brad Bishop6e60e8b2018-02-01 10:27:11 -050060 postrm = d.getVar('pkg_postrm_%s' % pkg)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050061 if not postrm:
62 postrm = '#!/bin/sh\n'
Brad Bishop6e60e8b2018-02-01 10:27:11 -050063 postrm += d.getVar('gtk_icon_cache_postrm')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050064 d.setVar('pkg_postrm_%s' % pkg, postrm)
65}
66