# 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_PHASES_ONLY} ]]; 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_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_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} MyModuleVersion=$(pango-module_version) EOF if [[ ${CATEGORY}/${PN} == x11-libs/pango ]]; then echo "PangoModuleVersion=$(pango-module_version)" >>"${T}"/${name} fi ( insinto ${dir} doins "${T}"/${name} ) || die "doins failed" 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_path. pango-module_standard_path() { echo /usr/$(get_libdir)/pango/$(pango-module_version)/modules } # @FUNCTION: pango-module_version # @RETURN: Returns the Pango module ABI version. if [[ -z ${PANGO_MODULE_PHASES_ONLY} ]]; then 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_PHASES_ONLY is set" } fi # @ECLASS-VARIABLE: PANGO_MODULE_PHASES_ONLY # @DESCRIPTION: # Set to non-empty, before inheriting the eclass, if the ebuild uses # only pango-module_pkg_postinst and pango-module_pkg_postrm, to avoid # adding the extra dependencies needed for the other functions to # work. Mainly for use by app-emulation/emul-linux-x86-gtklibs. PANGO_MODULE_PHASES_ONLY= # 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 shouldn't use this directly, it's 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