Skip to content

Commit

Permalink
vala.eclass: add function to generate supported atoms with USE
Browse files Browse the repository at this point in the history
Signed-off-by: Gilles Dartiguelongue <[email protected]>
Signed-off-by: Mart Raudsepp <[email protected]>
  • Loading branch information
EvaSDK authored and leio committed Feb 11, 2019
1 parent 5ba27de commit 21a150f
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions eclass/vala.eclass
Original file line number Diff line number Diff line change
Expand Up @@ -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 " )"
Expand All @@ -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
Expand Down

0 comments on commit 21a150f

Please sign in to comment.