Merge branch 'org.openembedded.dev' of git@git.openembedded.net:openembedded into...
[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 gtk-update-icon-cache -q /usr/share/icons/hicolor
15 }
16
17 gtk_icon_cache_postrm() {
18 gtk-update-icon-cache -q /usr/share/icons/hicolor
19 }
20
21 python populate_packages_append () {
22         import os.path
23         packages = bb.data.getVar('PACKAGES', d, 1).split()
24         workdir = bb.data.getVar('WORKDIR', d, 1)
25         
26         for pkg in packages:
27                 icon_dir = '%s/install/%s/%s/icons/hicolor' % (workdir, pkg, bb.data.getVar('datadir', d, 1))
28                 if not os.path.exists(icon_dir):
29                         continue
30                 
31                 bb.note("adding gtk-icon-cache postinst and postrm scripts to %s" % pkg)
32                 
33                 postinst = bb.data.getVar('pkg_postinst_%s' % pkg, d, 1) or bb.data.getVar('pkg_postinst', d, 1)
34                 if not postinst:
35                         postinst = '#!/bin/sh\n'
36                 postinst += bb.data.getVar('gtk_icon_cache_postinst', d, 1)
37                 bb.data.setVar('pkg_postinst_%s' % pkg, postinst, d)
38
39                 postrm = bb.data.getVar('pkg_postrm_%s' % pkg, d, 1) or bb.data.getVar('pkg_postrm', d, 1)
40                 if not postrm:
41                         postrm = '#!/bin/sh\n'
42                 postrm += bb.data.getVar('gtk_icon_cache_postrm', d, 1)
43                 bb.data.setVar('pkg_postrm_%s' % pkg, postrm, d)
44 }
45