| 1 | # Copyright 1999-2012 Gentoo Foundation |
1 | # Copyright 1999-2012 Gentoo Foundation |
| 2 | # Distributed under the terms of the GNU General Public License v2 |
2 | # Distributed under the terms of the GNU General Public License v2 |
| 3 | # $Header: /var/cvsroot/gentoo-x86/eclass/vala.eclass,v 1.4 2012/09/20 04:48:26 tetromino Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/vala.eclass,v 1.5 2012/12/02 11:26:07 pacho Exp $ |
| 4 | |
4 | |
| 5 | # @ECLASS: vala.eclass |
5 | # @ECLASS: vala.eclass |
| 6 | # @MAINTAINER: |
6 | # @MAINTAINER: |
| 7 | # gnome@gentoo.org |
7 | # gnome@gentoo.org |
| 8 | # @AUTHOR: |
8 | # @AUTHOR: |
| … | |
… | |
| 14 | # packages whose build systems assume the existence of certain unversioned vala |
14 | # packages whose build systems assume the existence of certain unversioned vala |
| 15 | # executables, pkgconfig files, etc., which Gentoo does not provide. |
15 | # executables, pkgconfig files, etc., which Gentoo does not provide. |
| 16 | # |
16 | # |
| 17 | # This eclass provides one phase function: src_prepare. |
17 | # This eclass provides one phase function: src_prepare. |
| 18 | |
18 | |
| 19 | inherit multilib |
19 | inherit eutils multilib |
| 20 | |
20 | |
| 21 | case "${EAPI:-0}" in |
21 | case "${EAPI:-0}" in |
| 22 | 0) die "EAPI=0 is not supported" ;; |
22 | 0) die "EAPI=0 is not supported" ;; |
| 23 | 1) ;; |
23 | 1) ;; |
| 24 | *) EXPORT_FUNCTIONS src_prepare ;; |
24 | *) EXPORT_FUNCTIONS src_prepare ;; |
| … | |
… | |
| 73 | has_version "dev-lang/vala:${v}${u}" && echo "${v}" && return |
73 | has_version "dev-lang/vala:${v}${u}" && echo "${v}" && return |
| 74 | done |
74 | done |
| 75 | } |
75 | } |
| 76 | |
76 | |
| 77 | # @FUNCTION: vala_src_prepare |
77 | # @FUNCTION: vala_src_prepare |
| 78 | # @USAGE: [--vala-api-version api_version] |
78 | # @USAGE: [--ignore-use] [--vala-api-version api_version] |
| 79 | # @DESCRIPTION: |
79 | # @DESCRIPTION: |
| 80 | # Sets up the environment variables and pkgconfig files for the |
80 | # Sets up the environment variables and pkgconfig files for the |
| 81 | # specified API version, or, if no version is specified, for the |
81 | # specified API version, or, if no version is specified, for the |
| 82 | # highest installed vala API version satisfying |
82 | # highest installed vala API version satisfying |
| 83 | # VALA_MAX_API_VERSION, VALA_MIN_API_VERSION, and VALA_USE_DEPEND. |
83 | # VALA_MAX_API_VERSION, VALA_MIN_API_VERSION, and VALA_USE_DEPEND. |
| 84 | # Dies if called without --vala-api-version and no suitable vala |
84 | # Is a no-op if called without --ignore-use when USE=-vala. |
| 85 | # version is found. |
85 | # Dies if the USE check is passed (or ignored) and a suitable vala |
|
|
86 | # version is not available. |
| 86 | vala_src_prepare() { |
87 | vala_src_prepare() { |
| 87 | local p d valafoo version |
88 | local p d valafoo version ignore_use |
| 88 | |
89 | |
| 89 | if [[ $1 = "--vala-api-version" ]]; then |
90 | while [[ $1 ]]; do |
|
|
91 | case $1 in |
|
|
92 | "--ignore-use" ) |
|
|
93 | ignore_use=1 ;; |
|
|
94 | "--vala-api-version" ) |
|
|
95 | shift |
| 90 | version=$2 |
96 | version=$1 |
| 91 | [[ ${version} ]] || die "'--vala-api-version' option requires API version parameter." |
97 | [[ ${version} ]] || die "'--vala-api-version' option requires API version parameter." |
|
|
98 | esac |
|
|
99 | shift |
|
|
100 | done |
|
|
101 | |
|
|
102 | if [[ -z ${ignore_use} ]]; then |
|
|
103 | in_iuse vala && ! use vala && return 0 |
|
|
104 | fi |
|
|
105 | |
|
|
106 | if [[ ${version} ]]; then |
|
|
107 | has_version "dev-lang/vala:${version}" || die "No installed vala:${version}" |
| 92 | else |
108 | else |
| 93 | version=$(vala_best_api_version) |
109 | version=$(vala_best_api_version) |
| 94 | [[ ${version} ]] || die "No installed vala in $(vala_depend)" |
110 | [[ ${version} ]] || die "No installed vala in $(vala_depend)" |
| 95 | fi |
111 | fi |
| 96 | |
112 | |