diff options
author | Gilles Dartiguelongue <eva@gentoo.org> | 2019-01-04 10:45:59 +0100 |
---|---|---|
committer | Mart Raudsepp <leio@gentoo.org> | 2019-02-11 19:14:35 +0200 |
commit | 21a150f252a072b68c66c5f822db505a594aae4f (patch) | |
tree | 11c77042dc41de36256072d5cc1d4ac40a6a3e5e | |
parent | gnome.org.eclass: BDEPEND for xz-utils with EAPI-7 (diff) | |
download | gentoo-21a150f252a072b68c66c5f822db505a594aae4f.tar.gz gentoo-21a150f252a072b68c66c5f822db505a594aae4f.tar.bz2 gentoo-21a150f252a072b68c66c5f822db505a594aae4f.zip |
vala.eclass: add function to generate supported atoms with USE
Signed-off-by: Gilles Dartiguelongue <eva@gentoo.org>
Signed-off-by: Mart Raudsepp <leio@gentoo.org>
-rw-r--r-- | eclass/vala.eclass | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/eclass/vala.eclass b/eclass/vala.eclass index 11fd875d5d99..715ce9581244 100644 --- a/eclass/vala.eclass +++ b/eclass/vala.eclass @@ -59,16 +59,33 @@ vala_api_versions() { done } +# Outputs VALA_USE_DEPEND as a a USE-dependency string +_vala_use_depend() { + local u="" vala_use + + if [[ -n ${VALA_USE_DEPEND} ]]; then + for vala_use in ${VALA_USE_DEPEND}; do + case ${vala_use} in + vapigen) u="${u},${vala_use}(+)" ;; + valadoc) u="${u},${vala_use}(-)" ;; + esac + done + u="[${u#,}]" + fi + + echo -n "${u}" +} + # @FUNCTION: vala_depend # @DESCRIPTION: # Outputs a ||-dependency string on vala from VALA_MAX_API_VERSION down to # VALA_MIN_API_VERSION vala_depend() { - local u v versions=$(vala_api_versions) - [[ ${VALA_USE_DEPEND} ]] && u="[${VALA_USE_DEPEND}(+)]" + local u v + u=$(_vala_use_depend) echo -n "|| (" - for v in ${versions}; do + for v in $(vala_api_versions); do echo -n " dev-lang/vala:${v}${u}" done echo " )" @@ -80,7 +97,8 @@ vala_depend() { # VALA_MAX_API_VERSION, VALA_MIN_API_VERSION, and VALA_USE_DEPEND. vala_best_api_version() { local u v - [[ ${VALA_USE_DEPEND} ]] && u="[${VALA_USE_DEPEND}(+)]" + u=$(_vala_use_depend) + for v in $(vala_api_versions); do has_version "dev-lang/vala:${v}${u}" && echo "${v}" && return done |