public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] rfc: [patch]  bash-completion-r1.eclass: add support for pkg-config for migration to the new upstream defined bash-completion directories (prereq for bug 472938)
@ 2013-06-12 22:22 Samuli Suominen
  2013-06-13  4:58 ` Michał Górny
  2013-06-13 16:29 ` Michał Górny
  0 siblings, 2 replies; 10+ messages in thread
From: Samuli Suominen @ 2013-06-12 22:22 UTC (permalink / raw
  To: Michał Górny, gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 300 bytes --]

what $subject says,

"add support for pkg-config for migration to the new upstream defined 
bash-completion directories (prereq for bug 472938)"

http://bugs.gentoo.org/472938

ie. the pkg-config file shipped *now* in portage is a hack from me to 
postpone this

pretty tired so more eyes is cool ;)

[-- Attachment #2: bash-completion-r1.eclass.patch --]
[-- Type: text/x-patch, Size: 2007 bytes --]

--- 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 '<app-shells/bash-completion-2.1-r1'; then
+		_get_bashdir completionsdir /usr/share/bash-completion
+	else
+		_get_bashdir completionsdir /usr/share/bash-completion/completions
+	fi
+}
+
+# @FUNCTION: get_bashhelpersdir
+# @RETURN: helpersdir value from bash-completion.pc if it's available
+# @DESCRIPTION:
+# If bash-completion.pc pkg-config file is available, query the correct
+# "helpersdir=" value and return it
+# Otherwise fallback to /usr/share/bash-completion/completions
+get_bashhelpersdir() {
+	_get_bashdir helpersdir /usr/share/bash-completion/helpers
+}
+
 # @FUNCTION: dobashcomp
 # @USAGE: file [...]
 # @DESCRIPTION:
@@ -32,7 +75,7 @@
 	debug-print-function ${FUNCNAME} "${@}"
 
 	(
-		insinto /usr/share/bash-completion
+		insinto "$(get_bashcompdir)"
 		doins "${@}"
 	)
 }
@@ -46,7 +89,7 @@
 	debug-print-function ${FUNCNAME} "${@}"
 
 	(
-		insinto /usr/share/bash-completion
+		insinto "$(get_bashcompdir)"
 		newins "${@}"
 	)
 }

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-06-13 16:29 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-12 22:22 [gentoo-dev] rfc: [patch] bash-completion-r1.eclass: add support for pkg-config for migration to the new upstream defined bash-completion directories (prereq for bug 472938) Samuli Suominen
2013-06-13  4:58 ` Michał Górny
2013-06-13  6:23   ` Samuli Suominen
2013-06-13  6:59     ` Ulrich Mueller
2013-06-13  6:59       ` Ulrich Mueller
2013-06-13  9:05       ` Samuli Suominen
2013-06-13  9:14         ` Ulrich Mueller
2013-06-13  9:30           ` Samuli Suominen
2013-06-13 15:25         ` Michał Górny
2013-06-13 16:29 ` Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox