# Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ # @ECLASS: pango-module.eclass # @MAINTAINER: # gnome@gentoo.org # @BLURB: common functions for ebuilds that install Pango modules # @DESCRIPTION: # This eclass contains functions to help install Pango modules and # manage the Pango modules path in conjunction with eselect-pango. inherit multilib RDEPEND="app-admin/eselect-pango" if [[ -z ${PANGO_MODULE_NO_EXTRA_DEPS} ]]; then DEPEND=">=dev-util/pkgconfig-0.18" if [[ ${CATEGORY}/${PN} != x11-libs/pango ]]; then # This is here because it is used by the eclass itself, for # its .pc file. It's not in RDEPEND because ebuilds should # specify that explicitly. DEPEND="${DEPEND} x11-libs/pango" fi fi # @FUNCTION: pango-module-add-modules-path # @USAGE: # @DESCRIPTION: # Register as containing Pango modules. should be of # the form , and determines the order in # which the directories will be added to the search path (modules in # later directories override earlier ones). This function should be # called in src_install. pango-module-add-modules-path() { local name=$1 path="${2}" local dir=/etc/env.d/pango pango-module-multilib-enabled && dir=${dir}/${CHOST} [[ -e "${T}"/${name} ]] && die "${T}/${name} already exists" cat <<-EOF >"${T}"/${name} ModulesPath=${2} EOF local save_INSDESTTREE=${INSDESTTREE} insinto ${dir} doins "${T}"/${name} || die "doins failed" INSDESTTREE=${save_INSDESTTREE} rm -f "${T}"/${name} } # @FUNCTION: pango-module-standard-path # @RETURN: /usr/$(get_libdir)/pango/$(pango-module-version)/modules # @DESCRIPTION: # Modules are typically installed under # /usr/$(get_libdir)/pango/$(pango-module-version)/modules. This # should be handled by the package's build system, but ebuilds need to # know the directory to pass it or a subdirectory to # pango-module-add-modules-path. pango-module-standard-path() { echo /usr/$(get_libdir)/pango/$(pango-module-version)/modules } if [[ -z ${PANGO_MODULE_NO_EXTRA_DEPS} ]]; then # @FUNCTION: pango-module-version # @RETURN: Returns the Pango module ABI version. pango-module-version() { local ver if [[ ${CATEGORY}/${PN} == x11-libs/pango ]]; then ver="$(PKG_CONFIG_PATH="${S}" PKG_CONFIG_DISABLE_UNINSTALLED=1 pkg-config --variable=pango_module_version pango)" else ver="$(pkg-config --variable=pango_module_version pango)" fi # Might not work because this gets called in a subshell. :-( [[ -n ${ver} ]] || die "Could not determine pango-module-version" echo "${ver}" } else pango-module-version() { die "Can't call pango-module-version because PANGO_MODULE_NO_EXTRA_DEPS is set" } fi # @ECLASS-VARIABLE: PANGO_MODULE_NO_EXTRA_DEPS # @DESCRIPTION: # Set to non-empty, before inheriting the eclass, if the ebuild does # not use the pango-module-version or pango-module-standard-path # functions, to avoid adding the extra dependencies needed for these # functions to work. Mainly for use by app-emulation/emul-linux-x86-gtklibs. PANGO_MODULE_NO_EXTRA_DEPS= # We need to unconditionally set this to empty for eclass-manpages to # work properly. It doesn't matter because we've already used it by # this point. # @FUNCTION: pango-module_pkg_postinst # @DESCRIPTION: # Runs eselect pango update to update the /etc/pango/pango.modules file. pango-module_pkg_postinst() { if [[ ${ROOT} == / ]]; then eselect pango update else ewarn 'Not updating pango.modules because ${ROOT} != /' fi } # @FUNCTION: pango-module_pkg_postrm # @DESCRIPTION: # Runs eselect pango update to update the /etc/pango/pango.modules file. pango-module_pkg_postrm() { if [[ ${ROOT} == / ]]; then eselect pango update else ewarn 'Not updating pango.modules because ${ROOT} != /' fi } # @FUNCTION: pango-module-multilib-enabled # @RETURN: True if an extra ${CHOST} directory under /etc/pango should be used. # @DESCRIPTION: # Most ebuilds won't need to use this, it's mainly for internal use # and for Pango itself. pango-module-multilib-enabled() { has_multilib_profile || ( use x86 && [[ $(get_libdir) == lib32 ]] ) } EXPORT_FUNCTIONS pkg_postinst pkg_postrm