nzbget: new recipe; a command-line based binary newsgrabber for nzb files
[vuplus_openembedded] / classes / gtk-icon-cache.bbclass
1 FILES_${PN} += "${datadir}/icons/hicolor"
2 RDEPENDS += "hicolor-icon-theme"
3
4 # This could run on the host as icon cache files are architecture independent,
5 # but there is no gtk-update-icon-cache built natively.
6 gtk_icon_cache_postinst() {
7 if [ "x$D" != "x" ]; then
8         exit 1
9 fi
10
11 # Update the pixbuf loaders in case they haven't been registered yet
12 gdk-pixbuf-query-loaders > /etc/gtk-2.0/gdk-pixbuf.loaders
13
14 for icondir in /usr/share/icons/* ; do
15     if [ -d $icondir ] ; then
16         gtk-update-icon-cache -qt  $icondir
17     fi
18 done
19 }
20
21 gtk_icon_cache_postrm() {
22 for icondir in /usr/share/icons/* ; do
23     if [ -d $icondir ] ; then
24         gtk-update-icon-cache -qt  $icondir
25     fi
26 done
27 }
28
29 python populate_packages_append () {
30         import os.path
31         packages = bb.data.getVar('PACKAGES', d, 1).split()
32         workdir = bb.data.getVar('WORKDIR', d, 1)
33         
34         for pkg in packages:
35                 icon_dir = '%s/install/%s/%s/icons' % (workdir, pkg, bb.data.getVar('datadir', d, 1))
36                 if not os.path.exists(icon_dir):
37                         continue
38                 
39                 bb.note("adding gtk-icon-cache postinst and postrm scripts to %s" % pkg)
40                 
41                 postinst = bb.data.getVar('pkg_postinst_%s' % pkg, d, 1) or bb.data.getVar('pkg_postinst', d, 1)
42                 if not postinst:
43                         postinst = '#!/bin/sh\n'
44                 postinst += bb.data.getVar('gtk_icon_cache_postinst', d, 1)
45                 bb.data.setVar('pkg_postinst_%s' % pkg, postinst, d)
46
47                 postrm = bb.data.getVar('pkg_postrm_%s' % pkg, d, 1) or bb.data.getVar('pkg_postrm', d, 1)
48                 if not postrm:
49                         postrm = '#!/bin/sh\n'
50                 postrm += bb.data.getVar('gtk_icon_cache_postrm', d, 1)
51                 bb.data.setVar('pkg_postrm_%s' % pkg, postrm, d)
52 }
53