From 21a150f252a072b68c66c5f822db505a594aae4f Mon Sep 17 00:00:00 2001 From: Gilles Dartiguelongue Date: Fri, 4 Jan 2019 10:45:59 +0100 Subject: vala.eclass: add function to generate supported atoms with USE Signed-off-by: Gilles Dartiguelongue Signed-off-by: Mart Raudsepp --- eclass/vala.eclass | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'eclass') 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 -- cgit v1.2.3-65-gdbad