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