summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorSamuli Suominen <ssuominen@gentoo.org>2013-07-15 23:54:03 +0000
committerSamuli Suominen <ssuominen@gentoo.org>2013-07-15 23:54:03 +0000
commit68f50ccf41067bd93b71e121a5784b625bb0207d (patch)
tree53a3e671ccb0a1331945162567f29d2f27abb988 /eclass
parentversion bump (diff)
downloadgentoo-2-68f50ccf41067bd93b71e121a5784b625bb0207d.tar.gz
gentoo-2-68f50ccf41067bd93b71e121a5784b625bb0207d.tar.bz2
gentoo-2-68f50ccf41067bd93b71e121a5784b625bb0207d.zip
Support pkg-config and the new upstream completions directory structure wrt #472938 and introduce new get_bashhelpersdir function to obtain the helpersdir="" value.
Diffstat (limited to 'eclass')
-rw-r--r--eclass/ChangeLog8
-rw-r--r--eclass/bash-completion-r1.eclass60
2 files changed, 61 insertions, 7 deletions
diff --git a/eclass/ChangeLog b/eclass/ChangeLog
index b3b230aeeed7..8ffae9303a07 100644
--- a/eclass/ChangeLog
+++ b/eclass/ChangeLog
@@ -1,6 +1,12 @@
# ChangeLog for eclass directory
# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.880 2013/07/15 14:04:31 ssuominen Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.881 2013/07/15 23:54:03 ssuominen Exp $
+
+ 15 Jul 2013; Samuli Suominen <ssuominen@gentoo.org>
+ bash-completion-r1.eclass:
+ Support pkg-config and the new upstream completions directory structure wrt
+ #472938 and introduce new get_bashhelpersdir function to obtain the
+ helpersdir="" value.
15 Jul 2013; Samuli Suominen <ssuominen@gentoo.org> kernel-2.eclass:
Deprecate media-sound/alsa-headers by letting sys-kernel/linux-headers
diff --git a/eclass/bash-completion-r1.eclass b/eclass/bash-completion-r1.eclass
index 31a83f01e145..bd254584fa9f 100644
--- a/eclass/bash-completion-r1.eclass
+++ b/eclass/bash-completion-r1.eclass
@@ -1,6 +1,6 @@
# 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.4 2013/06/13 16:23:56 mgorny Exp $
+# $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:
@@ -9,39 +9,87 @@
# @EXAMPLE:
#
# @CODE
-# EAPI=4
+# 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 directory.
+# Get unprefixed bash-completion completions directory.
_bash-completion-r1_get_bashcompdir() {
debug-print-function ${FUNCNAME} "${@}"
- echo /usr/share/bash-completion
+ if has_version '<app-shells/bash-completion-2.1-r1'; then
+ _bash-completion-r1_get_bashdir completionsdir /usr/share/bash-completion
+ else
+ _bash-completion-r1_get_bashdir completionsdir /usr/share/bash-completion/completions
+ fi
+}
+
+# @FUNCTION: _bash-completion-r1_get_helpersdir
+# @INTERNAL
+# @DESCRIPTION:
+# Get unprefixed bash-completion helpers directory.
+_bash-completion-r1_get_bashhelpersdir() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ _bash-completion-r1_get_bashdir helpersdir /usr/share/bash-completion/helpers
}
# @FUNCTION: get_bashcompdir
# @DESCRIPTION:
-# Get the bash-completion directory.
+# Get the bash-completion completions directory.
get_bashcompdir() {
debug-print-function ${FUNCNAME} "${@}"
echo "${EPREFIX}$(_bash-completion-r1_get_bashcompdir)"
}
+# @FUNCTION: get_bashhelpersdir
+# @INTERNAL
+# @DESCRIPTION:
+# Get the bash-completion helpers directory.
+get_bashhelpersdir() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ echo "${EPREFIX}$(_bash-completion-r1_get_bashhelpersdir)"
+}
+
# @FUNCTION: dobashcomp
# @USAGE: file [...]
# @DESCRIPTION: