From patchwork Tue Dec 4 13:59:10 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [3/5] gtk-icon-cache: run the icon generation at rootfs time Date: Tue, 04 Dec 2012 13:59:10 -0000 From: Laurentiu Palcu X-Patchwork-Id: 40279 Message-Id: <87e5e6b5b89c4dc8c81b388bdce126076b4b11cc.1354626535.git.laurentiu.palcu@intel.com> To: openembedded-core@lists.openembedded.org, schnitzeltony@googlemail.com This change will allow for the icon cache generation at rootfs time and only once, at the end. So, even though there will be many packages depending on gtk+, the icon cache generation will be done once. Hopefully, this will lower the target's first boot time significantly by using the power of the host machine to generate the cache. Signed-off-by: Laurentiu Palcu --- meta/classes/gtk-icon-cache.bbclass | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/meta/classes/gtk-icon-cache.bbclass b/meta/classes/gtk-icon-cache.bbclass index 01fb2f3..f87a30f 100644 --- a/meta/classes/gtk-icon-cache.bbclass +++ b/meta/classes/gtk-icon-cache.bbclass @@ -1,12 +1,22 @@ FILES_${PN} += "${datadir}/icons/hicolor" -DEPENDS += "${@['hicolor-icon-theme', '']['${BPN}' == 'hicolor-icon-theme']}" +DEPENDS += "${@['hicolor-icon-theme', '']['${BPN}' == 'hicolor-icon-theme']} gtk+-native" -# This could run on the host as icon cache files are architecture independent, -# but there is no gtk-update-icon-cache built natively. gtk_icon_cache_postinst() { if [ "x$D" != "x" ]; then - exit 1 + if [ ! -f $INTERCEPT_DIR/update_icon_cache ]; then + cat << "EOF" > $INTERCEPT_DIR/update_icon_cache +#!/bin/sh + +# update native pixbuf loaders +gdk-pixbuf-query-loaders --update-cache + +for icondir in $D/usr/share/icons/*/ ; do + gtk-update-icon-cache -fqt $icondir +done +EOF + fi + exit 0 fi # Update the pixbuf loaders in case they haven't been registered yet