# Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/eclass/bash-completion-r1.eclass,v 1.5 2013/07/15 23:54:03 ssuominen Exp $ # @ECLASS: bash-completion-r1.eclass # @MAINTAINER: # mgorny@gentoo.org # @BLURB: A few quick functions to install bash-completion files # @EXAMPLE: # # @CODE # EAPI=5 # # src_configure() { # econf \ # --with-bash-completion-dir="$(get_bashcompdir)" # } # # src_install() { # default # # newbashcomp contrib/${PN}.bash-completion ${PN} # } # @CODE inherit toolchain-funcs case ${EAPI:-0} in 0|1|2|3|4|5) ;; *) die "EAPI ${EAPI} unsupported (yet)." esac # @FUNCTION: _bash-completion-r1_get_bashdir # @INTERNAL # @DESCRIPTION: # First argument is name of the string in bash-completion.pc # Second argument is the fallback directory if the string is not found # @EXAMPLE: # _bash-completion-r1_get_bashdir completionsdir /usr/share/bash-completion/completions _bash-completion-r1_get_bashdir() { debug-print-function ${FUNCNAME} "${@}" if $($(tc-getPKG_CONFIG) --exists bash-completion); then echo "$($(tc-getPKG_CONFIG) --variable=$1 bash-completion)" else echo $2 fi } # @FUNCTION: _bash-completion-r1_get_bashcompdir # @INTERNAL # @DESCRIPTION: # Get unprefixed bash-completion completions directory. _bash-completion-r1_get_bashcompdir() { debug-print-function ${FUNCNAME} "${@}" if has_version '