blob: dd394af27ca8d6a9f260588adc30981604859075 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001FILES_${PN} += "${datadir}/icons/hicolor"
2
Andrew Geissler475cb722020-07-10 16:00:51 -05003DEPENDS +=" ${@['hicolor-icon-theme', '']['${BPN}' == 'hicolor-icon-theme']} \
4 ${@['gdk-pixbuf', '']['${BPN}' == 'gdk-pixbuf']} \
5 ${@['gtk+3', '']['${BPN}' == 'gtk+3']} \
6 gtk+3-native \
7"
Patrick Williamsc124f4f2015-09-15 14:41:29 -05008
Brad Bishopc342db32019-05-15 21:57:59 -04009PACKAGE_WRITE_DEPS += "gtk+3-native gdk-pixbuf-native"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050010
Patrick Williamsc124f4f2015-09-15 14:41:29 -050011gtk_icon_cache_postinst() {
12if [ "x$D" != "x" ]; then
Brad Bishop96ff1982019-08-19 13:50:42 -040013 $INTERCEPT_DIR/postinst_intercept update_gtk_icon_cache ${PKG} \
Patrick Williamsf1e5d692016-03-30 15:21:19 -050014 mlprefix=${MLPREFIX} \
15 libdir_native=${libdir_native}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050016else
17
18 # Update the pixbuf loaders in case they haven't been registered yet
Patrick Williamsf1e5d692016-03-30 15:21:19 -050019 ${libdir}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders --update-cache
Patrick Williamsc124f4f2015-09-15 14:41:29 -050020
21 for icondir in /usr/share/icons/* ; do
22 if [ -d $icondir ] ; then
23 gtk-update-icon-cache -fqt $icondir
24 fi
25 done
26fi
27}
28
29gtk_icon_cache_postrm() {
30if [ "x$D" != "x" ]; then
Brad Bishop96ff1982019-08-19 13:50:42 -040031 $INTERCEPT_DIR/postinst_intercept update_gtk_icon_cache ${PKG} \
Patrick Williamsf1e5d692016-03-30 15:21:19 -050032 mlprefix=${MLPREFIX} \
33 libdir=${libdir}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050034else
35 for icondir in /usr/share/icons/* ; do
36 if [ -d $icondir ] ; then
37 gtk-update-icon-cache -qt $icondir
38 fi
39 done
40fi
41}
42
43python populate_packages_append () {
Brad Bishop6e60e8b2018-02-01 10:27:11 -050044 packages = d.getVar('PACKAGES').split()
45 pkgdest = d.getVar('PKGDEST')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050046
47 for pkg in packages:
Brad Bishop6e60e8b2018-02-01 10:27:11 -050048 icon_dir = '%s/%s/%s/icons' % (pkgdest, pkg, d.getVar('datadir'))
Patrick Williamsc124f4f2015-09-15 14:41:29 -050049 if not os.path.exists(icon_dir):
50 continue
51
52 bb.note("adding hicolor-icon-theme dependency to %s" % pkg)
53 rdepends = ' ' + d.getVar('MLPREFIX', False) + "hicolor-icon-theme"
54 d.appendVar('RDEPENDS_%s' % pkg, rdepends)
Andrew Geissler475cb722020-07-10 16:00:51 -050055
56 #gtk_icon_cache_postinst depend on gdk-pixbuf and gtk+3
57 bb.note("adding gdk-pixbuf dependency to %s" % pkg)
58 rdepends = ' ' + d.getVar('MLPREFIX', False) + "gdk-pixbuf"
59 d.appendVar('RDEPENDS_%s' % pkg, rdepends)
60
61 bb.note("adding gtk+3 dependency to %s" % pkg)
62 rdepends = ' ' + d.getVar('MLPREFIX', False) + "gtk+3"
63 d.appendVar('RDEPENDS_%s' % pkg, rdepends)
64
Patrick Williamsc124f4f2015-09-15 14:41:29 -050065 bb.note("adding gtk-icon-cache postinst and postrm scripts to %s" % pkg)
Andrew Geissler475cb722020-07-10 16:00:51 -050066
Brad Bishop6e60e8b2018-02-01 10:27:11 -050067 postinst = d.getVar('pkg_postinst_%s' % pkg)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050068 if not postinst:
69 postinst = '#!/bin/sh\n'
Brad Bishop6e60e8b2018-02-01 10:27:11 -050070 postinst += d.getVar('gtk_icon_cache_postinst')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050071 d.setVar('pkg_postinst_%s' % pkg, postinst)
72
Brad Bishop6e60e8b2018-02-01 10:27:11 -050073 postrm = d.getVar('pkg_postrm_%s' % pkg)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050074 if not postrm:
75 postrm = '#!/bin/sh\n'
Brad Bishop6e60e8b2018-02-01 10:27:11 -050076 postrm += d.getVar('gtk_icon_cache_postrm')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050077 d.setVar('pkg_postrm_%s' % pkg, postrm)
78}
79