blob: 0248ba285ef82796aef10a26ce4c9283f60c00a7 [file] [log] [blame]
Patrick Williams213cb262021-08-07 19:21:33 -05001FILES:${PN} += "${datadir}/icons/hicolor"
Patrick Williamsc124f4f2015-09-15 14:41:29 -05002
Andrew Geissler635e0e42020-08-21 15:58:33 -05003#gtk+3 reqiure GTK3DISTROFEATURES, DEPENDS on it make all the
4#recipes inherit this class require GTK3DISTROFEATURES
5inherit features_check
6ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}"
7
Andrew Geissler475cb722020-07-10 16:00:51 -05008DEPENDS +=" ${@['hicolor-icon-theme', '']['${BPN}' == 'hicolor-icon-theme']} \
9 ${@['gdk-pixbuf', '']['${BPN}' == 'gdk-pixbuf']} \
10 ${@['gtk+3', '']['${BPN}' == 'gtk+3']} \
11 gtk+3-native \
12"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050013
Brad Bishopc342db32019-05-15 21:57:59 -040014PACKAGE_WRITE_DEPS += "gtk+3-native gdk-pixbuf-native"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050015
Patrick Williamsc124f4f2015-09-15 14:41:29 -050016gtk_icon_cache_postinst() {
17if [ "x$D" != "x" ]; then
Brad Bishop96ff1982019-08-19 13:50:42 -040018 $INTERCEPT_DIR/postinst_intercept update_gtk_icon_cache ${PKG} \
Patrick Williamsf1e5d692016-03-30 15:21:19 -050019 mlprefix=${MLPREFIX} \
20 libdir_native=${libdir_native}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050021else
22
23 # Update the pixbuf loaders in case they haven't been registered yet
Patrick Williamsf1e5d692016-03-30 15:21:19 -050024 ${libdir}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders --update-cache
Patrick Williamsc124f4f2015-09-15 14:41:29 -050025
26 for icondir in /usr/share/icons/* ; do
27 if [ -d $icondir ] ; then
28 gtk-update-icon-cache -fqt $icondir
29 fi
30 done
31fi
32}
33
34gtk_icon_cache_postrm() {
35if [ "x$D" != "x" ]; then
Brad Bishop96ff1982019-08-19 13:50:42 -040036 $INTERCEPT_DIR/postinst_intercept update_gtk_icon_cache ${PKG} \
Patrick Williamsf1e5d692016-03-30 15:21:19 -050037 mlprefix=${MLPREFIX} \
38 libdir=${libdir}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050039else
40 for icondir in /usr/share/icons/* ; do
41 if [ -d $icondir ] ; then
42 gtk-update-icon-cache -qt $icondir
43 fi
44 done
45fi
46}
47
Patrick Williams213cb262021-08-07 19:21:33 -050048python populate_packages:append () {
Brad Bishop6e60e8b2018-02-01 10:27:11 -050049 packages = d.getVar('PACKAGES').split()
50 pkgdest = d.getVar('PKGDEST')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050051
52 for pkg in packages:
Brad Bishop6e60e8b2018-02-01 10:27:11 -050053 icon_dir = '%s/%s/%s/icons' % (pkgdest, pkg, d.getVar('datadir'))
Patrick Williamsc124f4f2015-09-15 14:41:29 -050054 if not os.path.exists(icon_dir):
55 continue
56
57 bb.note("adding hicolor-icon-theme dependency to %s" % pkg)
58 rdepends = ' ' + d.getVar('MLPREFIX', False) + "hicolor-icon-theme"
Patrick Williams213cb262021-08-07 19:21:33 -050059 d.appendVar('RDEPENDS:%s' % pkg, rdepends)
Andrew Geissler475cb722020-07-10 16:00:51 -050060
61 #gtk_icon_cache_postinst depend on gdk-pixbuf and gtk+3
62 bb.note("adding gdk-pixbuf dependency to %s" % pkg)
63 rdepends = ' ' + d.getVar('MLPREFIX', False) + "gdk-pixbuf"
Patrick Williams213cb262021-08-07 19:21:33 -050064 d.appendVar('RDEPENDS:%s' % pkg, rdepends)
Andrew Geissler475cb722020-07-10 16:00:51 -050065
66 bb.note("adding gtk+3 dependency to %s" % pkg)
67 rdepends = ' ' + d.getVar('MLPREFIX', False) + "gtk+3"
Patrick Williams213cb262021-08-07 19:21:33 -050068 d.appendVar('RDEPENDS:%s' % pkg, rdepends)
Andrew Geissler475cb722020-07-10 16:00:51 -050069
Patrick Williamsc124f4f2015-09-15 14:41:29 -050070 bb.note("adding gtk-icon-cache postinst and postrm scripts to %s" % pkg)
Andrew Geissler475cb722020-07-10 16:00:51 -050071
Patrick Williams213cb262021-08-07 19:21:33 -050072 postinst = d.getVar('pkg_postinst:%s' % pkg)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050073 if not postinst:
74 postinst = '#!/bin/sh\n'
Brad Bishop6e60e8b2018-02-01 10:27:11 -050075 postinst += d.getVar('gtk_icon_cache_postinst')
Patrick Williams213cb262021-08-07 19:21:33 -050076 d.setVar('pkg_postinst:%s' % pkg, postinst)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050077
Patrick Williams213cb262021-08-07 19:21:33 -050078 postrm = d.getVar('pkg_postrm:%s' % pkg)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050079 if not postrm:
80 postrm = '#!/bin/sh\n'
Brad Bishop6e60e8b2018-02-01 10:27:11 -050081 postrm += d.getVar('gtk_icon_cache_postrm')
Patrick Williams213cb262021-08-07 19:21:33 -050082 d.setVar('pkg_postrm:%s' % pkg, postrm)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050083}
84