--- bash-completion-r1.eclass 2013-06-13 01:09:24.933961265 +0300 +++ /tmp/bash-completion-r1.eclass 2013-06-13 01:08:51.846963274 +0300 @@ -9,7 +9,7 @@ # @EXAMPLE: # # @CODE -# EAPI=4 +# EAPI=5 # # src_install() { # default @@ -17,12 +17,55 @@ # newbashcomp contrib/${PN}.bash-completion ${PN} # } # @CODE +# +# @CODE +# EAPI=5 +# +# src_configure() { +# econf \ +# --with-udevdir="$(get_bashcompdir)" +# } +# @CODE + +inherit toolchain-funcs case ${EAPI:-0} in 0|1|2|3|4|5) ;; *) die "EAPI ${EAPI} unsupported (yet)." esac +_get_bashdir() { + if $($(tc-getPKG_CONFIG) --exists bash-completion); then + echo "$($(tc-getPKG_CONFIG) --variable=$1 bash-completion)" + else + echo $2 + fi +} + +# @FUNCTION: get_bashcompdir +# @RETURN: completionsdir value from bash-completion.pc if it's available +# @DESCRIPTION: +# If bash-completion.pc pkg-config file is available, query the correct +# "completionsdir=" value and return it +# Otherwise fallback to /usr/share/bash-completion/completions +get_bashcompdir() { + if has_version '