1# 2# Copyright OpenEmbedded Contributors 3# 4# SPDX-License-Identifier: MIT 5# 6 7# 8# This class will generate the proper postinst/postrm scriptlets for pixbuf 9# packages. 10# 11 12DEPENDS:append:class-target = " qemu-native" 13inherit qemu 14 15PIXBUF_PACKAGES ??= "${PN}" 16 17PACKAGE_WRITE_DEPS += "qemu-native gdk-pixbuf-native" 18 19pixbufcache_common() { 20if [ "x$D" != "x" ]; then 21 $INTERCEPT_DIR/postinst_intercept update_pixbuf_cache ${PKG} mlprefix=${MLPREFIX} binprefix=${MLPREFIX} libdir=${libdir} \ 22 bindir=${bindir} base_libdir=${base_libdir} 23else 24 25 # Update the pixbuf loaders in case they haven't been registered yet 26 ${libdir}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders --update-cache 27 28 if [ -x ${bindir}/gtk-update-icon-cache ] && [ -d ${datadir}/icons ]; then 29 for icondir in /usr/share/icons/*; do 30 if [ -d ${icondir} ]; then 31 gtk-update-icon-cache -t -q ${icondir} 32 fi 33 done 34 fi 35fi 36} 37 38python populate_packages:append() { 39 pixbuf_pkgs = d.getVar('PIXBUF_PACKAGES').split() 40 41 for pkg in pixbuf_pkgs: 42 bb.note("adding pixbuf postinst and postrm scripts to %s" % pkg) 43 postinst = d.getVar('pkg_postinst:%s' % pkg) or d.getVar('pkg_postinst') 44 if not postinst: 45 postinst = '#!/bin/sh\n' 46 postinst += d.getVar('pixbufcache_common') 47 d.setVar('pkg_postinst:%s' % pkg, postinst) 48 49 postrm = d.getVar('pkg_postrm:%s' % pkg) or d.getVar('pkg_postrm') 50 if not postrm: 51 postrm = '#!/bin/sh\n' 52 postrm += d.getVar('pixbufcache_common') 53 d.setVar('pkg_postrm:%s' % pkg, postrm) 54} 55 56gdkpixbuf_complete() { 57GDK_PIXBUF_FATAL_LOADER=1 ${STAGING_LIBDIR_NATIVE}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders --update-cache || exit 1 58} 59 60DEPENDS:append:class-native = " gdk-pixbuf-native" 61SYSROOT_PREPROCESS_FUNCS:append:class-native = " pixbufcache_sstate_postinst" 62 63pixbufcache_sstate_postinst() { 64 mkdir -p ${SYSROOT_DESTDIR}${bindir} 65 dest=${SYSROOT_DESTDIR}${bindir}/postinst-${PN} 66 echo '#!/bin/sh' > $dest 67 echo "${gdkpixbuf_complete}" >> $dest 68 chmod 0755 $dest 69} 70