Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 472938 | Differences between
and this patch

Collapse All | Expand All

(-)bash-completion-r1.eclass (-3 / +46 lines)
Lines 9-15 Link Here
9
# @EXAMPLE:
9
# @EXAMPLE:
10
#
10
#
11
# @CODE
11
# @CODE
12
# EAPI=4
12
# EAPI=5
13
#
13
#
14
# src_install() {
14
# src_install() {
15
# 	default
15
# 	default
Lines 17-28 Link Here
17
# 	newbashcomp contrib/${PN}.bash-completion ${PN}
17
# 	newbashcomp contrib/${PN}.bash-completion ${PN}
18
# }
18
# }
19
# @CODE
19
# @CODE
20
#
21
# @CODE
22
# EAPI=5
23
#
24
# src_configure() {
25
# econf \
26
#	--with-udevdir="$(get_bashcompdir)"
27
# }
28
# @CODE
29
30
inherit toolchain-funcs
20
31
21
case ${EAPI:-0} in
32
case ${EAPI:-0} in
22
	0|1|2|3|4|5) ;;
33
	0|1|2|3|4|5) ;;
23
	*) die "EAPI ${EAPI} unsupported (yet)."
34
	*) die "EAPI ${EAPI} unsupported (yet)."
24
esac
35
esac
25
36
37
_get_bashdir() {
38
	if $($(tc-getPKG_CONFIG) --exists bash-completion); then
39
	echo "$($(tc-getPKG_CONFIG) --variable=$1 bash-completion)"
40
	else
41
		echo $2
42
	fi
43
}
44
45
# @FUNCTION: get_bashcompdir
46
# @RETURN: completionsdir value from bash-completion.pc if it's available
47
# @DESCRIPTION:
48
# If bash-completion.pc pkg-config file is available, query the correct
49
# "completionsdir=" value and return it
50
# Otherwise fallback to /usr/share/bash-completion/completions
51
get_bashcompdir() {
52
	if has_version '<app-shells/bash-completion-2.1-r1'; then
53
		_get_bashdir completionsdir /usr/share/bash-completion
54
	else
55
		_get_bashdir completionsdir /usr/share/bash-completion/completions
56
	fi
57
}
58
59
# @FUNCTION: get_bashhelpersdir
60
# @RETURN: helpersdir value from bash-completion.pc if it's available
61
# @DESCRIPTION:
62
# If bash-completion.pc pkg-config file is available, query the correct
63
# "helpersdir=" value and return it
64
# Otherwise fallback to /usr/share/bash-completion/completions
65
get_bashhelpersdir() {
66
	_get_bashdir helpersdir /usr/share/bash-completion/helpers
67
}
68
26
# @FUNCTION: dobashcomp
69
# @FUNCTION: dobashcomp
27
# @USAGE: file [...]
70
# @USAGE: file [...]
28
# @DESCRIPTION:
71
# @DESCRIPTION:
Lines 32-38 Link Here
32
	debug-print-function ${FUNCNAME} "${@}"
75
	debug-print-function ${FUNCNAME} "${@}"
33
76
34
	(
77
	(
35
		insinto /usr/share/bash-completion
78
		insinto "$(get_bashcompdir)"
36
		doins "${@}"
79
		doins "${@}"
37
	)
80
	)
38
}
81
}
Lines 46-52 Link Here
46
	debug-print-function ${FUNCNAME} "${@}"
89
	debug-print-function ${FUNCNAME} "${@}"
47
90
48
	(
91
	(
49
		insinto /usr/share/bash-completion
92
		insinto "$(get_bashcompdir)"
50
		newins "${@}"
93
		newins "${@}"
51
	)
94
	)
52
}
95
}

Return to bug 472938