Gentoo Archives: gentoo-dev

From: Alexandre Rostovtsev <tetromino@g.o>
To: Gentoo Dev <gentoo-dev@l.g.o>
Subject: [gentoo-dev] vala.eclass: change vala_src_prepare behavior when USE=-vala
Date: Wed, 19 Sep 2012 19:28:35
Message-Id: 1348082804.14335.9.camel@rook
1 Pacho Ramos has suggested making vala_src_prepare() into a no-op in the
2 common situation where vala is in IUSE and USE=-vala.
3
4 --- a/vala.eclass
5 +++ b/vala.eclass
6 @@ -77,20 +77,36 @@
7 }
8
9 # @FUNCTION: vala_src_prepare
10 -# @USAGE: [--vala-api-version api_version]
11 +# @USAGE: [--ignore-use] [--vala-api-version api_version]
12 # @DESCRIPTION:
13 # Sets up the environment variables and pkgconfig files for the
14 # specified API version, or, if no version is specified, for the
15 # highest installed vala API version satisfying
16 # VALA_MAX_API_VERSION, VALA_MIN_API_VERSION, and VALA_USE_DEPEND.
17 -# Dies if called without --vala-api-version and no suitable vala
18 -# version is found.
19 +# Is a no-op if called without --ignore-use when USE=-vala.
20 +# Dies if the USE check is passed (or ignored) and a suitable vala
21 +# version is not available.
22 vala_src_prepare() {
23 - local p d valafoo version
24 + local p d valafoo version ignore_use
25
26 - if [[ $1 = "--vala-api-version" ]]; then
27 - version=$2
28 - [[ ${version} ]] || die "'--vala-api-version' option requires API version parameter."
29 + while [[ $1 ]]; do
30 + case $1 in
31 + "--ignore-use" )
32 + ignore_use=1 ;;
33 + "--vala-api-version" )
34 + shift
35 + version=$1
36 + [[ ${version} ]] || die "'--vala-api-version' option requires API version parameter."
37 + esac
38 + shift
39 + done
40 +
41 + if [[ -z ${ignore_use} ]]; then
42 + has vala ${IUSE//+/} && ! use vala && return 0
43 + fi
44 +
45 + if [[ ${version} ]]; then
46 + has_version "dev-lang/vala:${version}" || die "No installed vala:${version}"
47 else
48 version=$(vala_best_api_version)
49 [[ ${version} ]] || die "No installed vala in $(vala_depend)"

Replies