diff options
author | Gregory M. Tuner <gmt@be-evil.net> | 2014-01-22 19:49:03 -0800 |
---|---|---|
committer | Gregory M. Tuner <gmt@be-evil.net> | 2014-01-22 19:49:03 -0800 |
commit | 1293fe10d8b0dfab2d57cf5bfdc7c62ced99f305 (patch) | |
tree | c8525845461b5b542b3b9f2a16c454e2031eb489 /eclass/gnome2-multilib.eclass | |
parent | x11-libs/xcb-util-wm: multilib-utize (diff) | |
download | gmt-1293fe10d8b0dfab2d57cf5bfdc7c62ced99f305.tar.gz gmt-1293fe10d8b0dfab2d57cf5bfdc7c62ced99f305.tar.bz2 gmt-1293fe10d8b0dfab2d57cf5bfdc7c62ced99f305.zip |
gnome2-multilib: multilib-utize various pkg_phases and related functions
Signed-off-by: Gregory M. Tuner <gmt@be-evil.net>
Diffstat (limited to 'eclass/gnome2-multilib.eclass')
-rw-r--r-- | eclass/gnome2-multilib.eclass | 149 |
1 files changed, 142 insertions, 7 deletions
diff --git a/eclass/gnome2-multilib.eclass b/eclass/gnome2-multilib.eclass index 5d5c0cd..22c3f25 100644 --- a/eclass/gnome2-multilib.eclass +++ b/eclass/gnome2-multilib.eclass @@ -43,6 +43,7 @@ fi # @DESCRIPTION: # Calls gnome2_src_unpack gnome2-multilib_src_unpack() { + debug-print-function ${FUNCNAME} "$@" gnome2_src_unpack "$@" } @@ -50,28 +51,47 @@ gnome2-multilib_src_unpack() { # @DESCRIPTION: # Calls autotools-multilib_src_compile gnome2-multilib_src_compile() { + debug-print-function ${FUNCNAME} "$@" autotools-multilib_src_compile "$@" } # @FUNCTION: gnome2-multilib_pkg_preinst # @DESCRIPTION: -# Calls gnome2_pkg_preinst +# Finds Icons, GConf and GSettings schemas for later handling in pkg_postinst gnome2-multilib_pkg_preinst() { - gnome2_pkg_preinst "$@" + debug-print-function ${FUNCNAME} "$@" + gnome2_gconf_savelist + gnome2_icon_savelist + gnome2_schemas_savelist + gnome2_scrollkeeper_savelist + gnome2-multilib_gdk_pixbuf_savelist } # @FUNCTION: gnome2-multilib_pkg_postinst # @DESCRIPTION: -# Calls gnome2_pkg_postinst +# Handle scrollkeeper, GConf, GSettings, Icons, desktop and mime +# database updates. gnome2-multilib_pkg_postinst() { - gnome2_pkg_postinst "$@" + debug-print-function ${FUNCNAME} "$@" + gnome2_gconf_install + fdo-mime_desktop_database_update + fdo-mime_mime_database_update + gnome2_icon_cache_update + gnome2_schemas_update + gnome2_scrollkeeper_update + gnome2-multilib_gdk_pixbuf_update } # @FUNCTION: gnome2-multilib_pkg_postrm # @DESCRIPTION: -# Calls gnome2_pkg_postrm +# Handle scrollkeeper, GSettings, Icons, desktop and mime database updates. gnome2-multilib_pkg_postrm() { - gnome2_pkg_postrm "$@" + debug-print-function ${FUNCNAME} "$@" + fdo-mime_desktop_database_update + fdo-mime_mime_database_update + gnome2_icon_cache_update + gnome2_schemas_update + gnome2_scrollkeeper_update } # @FUNCTION: gnome2-multilib_src_test @@ -362,7 +382,7 @@ gnome2-multilib_src_install() { # Since it was registered after the hook-wrapping listener to the same # ehook, if any gnome2-multilib-per-abi-pre_src_install -# ehook listener aborts the ehook, this listener will never be called, +# ehook listener aborts the ehook, this listener will never be called. _gnome2-multilib-per-abi-pre_src_install() { if [[ -z "${USE_EINSTALL}" || "${USE_EINSTALL}" = "0" ]]; then debug-print "Installing multilib abi ${ABI} with 'make install'" @@ -373,3 +393,118 @@ _gnome2-multilib-per-abi-pre_src_install() { return 1 fi } + +# @FUNCTION: gnome2-multilib_gdk_pixbuf_update +# @USAGE: gnome2-multilib_gdk_pixbuf_update +# @DESCRIPTION: +# Updates gdk-pixbuf loader cache if GNOME2_ECLASS_GDK_PIXBUF_LOADERS has some. +# This function should be called from pkg_postinst and pkg_postrm; this is a +# multilib-utization of the gnome2-utils API gnome2_gdk_pixbuf_update. It supports +# either invocation on a per-abi basis, or singular invocation from a non-multilib +# context (in which case, it will iterate over all the multilib ABIS and update them all). +gnome2-multilib_gdk_pixbuf_update() { + debug-print-function ${FUNCNAME} "$@" + + local GDK_PIXBUF_UPDATE_BIN=${GDK_PIXBUF_UPDATE_BIN:-/usr/bin/gdk-pixbuf-query-loaders} + if [[ ! -x ${EROOT}${GDK_PIXBUF_UPDATE_BIN} ]] ; then + debug-print "${FUNCNAME}: ${EROOT}${GDK_PIXBuF_UPDATE_BIN} not executable skipping." + return 0 + fi + # if this got called + if [[ ${MULTILIB_BUILD_ABI} ]] ; then + if [[ -x ${EROOT}${GDK_PIXBUF_UPDATE_BIN}-${MULTILIB_BUILD_ABI} ]] ; then + GDK_PIXBUF_UPDATE_BIN="${GDK_PIXBUF_UPDATE_BIN}-${MULTILIB_BUILD_ABI}" + gnome2_gdk_pixbuf_update "$@" + else + ewarn "${FUNCNAME}: couldn't find multilib pixbuf updater for ABI ${MULTILIB_BUILD_ABI}" + fi + else + # fancy! + multilib_foreach_abi gnome2-multilib_gdk_pixbuf_update "$@" + fi +} + +# @FUNCTION: gnome2-multilib_query_immodules_gtk2 +# @USAGE: gnome2-multilib_query_immodules_gtk2 +# @DESCRIPTION: +# Updates gtk2 immodules/gdk-pixbuf loaders listing; if called +# during multilib-build ABI iteration, will attempt to use +# the wrapped query tool. Otherwise, this will iterate through +# all the ABI's, using the wrapped query tools as appropriate. +gnome2-multilib_query_immodules_gtk2() { + debug-print-function ${FUNCNAME} "$@" + + if [[ ${MULTILIB_BUILD_ABI} ]] ; then + local query_exec="${EPREFIX}"/usr/bin/gtk-query-immodules-2.0 + if [[ -x "${EPREFIX}"/usr/bin/gtk-query-immodules-2.0-${MULTILIB_BUILD_ABI} ]]; then + query_exec="${EPREFIX}"/usr/bin/gtk-query-immodules-2.0-${MULTILIB_BUILD_ABI} + fi + if [[ ! -x ${query_exec} ]]; then + debug-print "${FUNCNAME}: Could not find any suitable gtk-query-immodules-2.0" + return 0 + elif has_version ">=x11-libs/gtk+-2.24.20:2[${MULTILIB_USEDEP}]"; then + ${query_exec} --update-cache + else + local GTK2_CONFDIR="/etc/gtk-2.0/$(get_abi_CHOST ${MULTILIB_BUILD_ABI})" + local gtk_conf="${EPREFIX}${GTK2_CONFDIR}/gtk.immodules" + local gtk_conf_dir=$(dirname "${gtk_conf}") + + einfo "Generating Gtk2 immodules/gdk-pixbuf loaders listing:" + einfo "-> ${gtk_conf}" + + mkdir -p "${gtk_conf_dir}" + local tmp_file=$(mktemp -t tmp.XXXXXXXXXXgtk_query_immodules) + if [ -z "${tmp_file}" ]; then + ewarn "gtk_query_immodules: cannot create temporary file" + return 1 + fi + + if ${query_exec} > "${tmp_file}"; then + cat "${tmp_file}" > "${gtk_conf}" || \ + ewarn "Failed to write to ${gtk_conf}" + else + ewarn "Cannot update gtk.immodules, file generation failed" + fi + rm "${tmp_file}" + fi + else + # fancy recursion... + multilib_foreach_abi gnome2-multilib_query_immodules_gtk2 "$@" + fi +} + +# @FUNCTION: gnome2-multilib_query_immodules_gtk3 +# @USAGE: gnome2-multilib_query_immodules_gtk3 +# @DESCRIPTION: +# Updates gtk3 immodules/gdk-pixbuf loaders listing. +gnome2-multilib_query_immodules_gtk3() { + debug-print-function ${FUNCNAME} "$@" + + if [[ ${MULTILIB_BUILD_ABI} ]]; then + if [[ -f "${EPREFIX}"/usr/bin/gtk-query-immodules-3.0-${MULTILIB_BUILD_ABI} ]]; then + "${EPREFIX}"/usr/bin/gtk-query-immodules-3.0-${MULTILIB_BUILD_ABI} --update-cache + else + "${EPREFIX}"/usr/bin/gtk-query-immodules-3.0 --update-cache + fi + else + multilib_foreach_abi gnome2-multilib_query_immodules_gtk3 + fi +} + +# @FUNCTION: gnome2-multilib_gdk_pixbuf_savelist +# @DESCRIPTION: +# Find if there is any gdk-pixbuf loader to install and save the list in +# GNOME2_ECLASS_GDK_PIXBUF_LOADERS_${ABI} variable, or, iterate through the +# multilib ABI's (if iteration is not already underway), calling ourselves +# for each. This function should be called from pkg_preinst. +gnome2-multilib_gdk_pixbuf_savelist() { + debug-print-function ${FUNCNAME} "$@" + + if [[ ${MULTILIB_BUILD_ABI} ]]; then + pushd "${ED}" >/dev/null || die "${FUNCNAME}: Cannot change directory to \"${ED}\"." + export GNOME2_ECLASS_GDK_PIXBUF_LOADERS=$(find "usr/$(get_libdir)/gdk-pixbuf-2.0" -type f 2>/dev/null) + popd >/dev/null || die "${FUNCNAME}: popd failed. no clue what's going on." + else + multilib_foreach_abi gnome2-multilib_gdk_pixbuf_savelist "$@" + fi +} |