merge of '093b89e2fccb4864b6f56bcb61c6455a90dc384e'
[vuplus_openembedded] / classes / gtk-icon-cache.bbclass
1 FILES_${PN} += "${datadir}/icons/hicolor"
2 RDEPENDS += " hicolor-icon-theme "
3
4 gtk-icon-cache_postinst() {
5 if [ "x$D" != "x" ]; then
6         exit 1
7 fi
8 gtk-update-icon-cache -q /usr/share/icons/hicolor
9 }
10
11 gtk-icon-cache_postrm() {
12 gtk-update-icon-cache -q /usr/share/icons/hicolor
13 }
14
15 python populate_packages_append () {
16         import os.path
17         packages = bb.data.getVar('PACKAGES', d, 1).split()
18         workdir = bb.data.getVar('WORKDIR', d, 1)
19         
20         for pkg in packages:
21                 icon_dir = '%s/install/%s/%s/icons/hicolor' % (workdir, pkg, bb.data.getVar('datadir', d, 1))
22                 if not os.path.exists(icon_dir):
23                         continue
24                 
25                 bb.note("adding gtk-icon-cache postinst and postrm scripts to %s" % pkg)
26                 
27                 postinst = bb.data.getVar('pkg_postinst_%s' % pkg, d, 1) or bb.data.getVar('pkg_postinst', d, 1)
28                 if not postinst:
29                         postinst = '#!/bin/sh\n'
30                 postinst += bb.data.getVar('gtk-icon-cache_postinst', d, 1)
31                 bb.data.setVar('pkg_postinst_%s' % pkg, postinst, d)
32
33                 postrm = bb.data.getVar('pkg_postrm_%s' % pkg, d, 1) or bb.data.getVar('pkg_postrm', d, 1)
34                 if not postrm:
35                         postrm = '#!/bin/sh\n'
36                 postrm += bb.data.getVar('gtk-icon-cache_postrm', d, 1)
37                 bb.data.setVar('pkg_postrm_%s' % pkg, postrm, d)
38 }
39