aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory M. Tuner <gmt@be-evil.net>2013-12-05 16:24:52 -0800
committerGregory M. Tuner <gmt@be-evil.net>2013-12-05 16:24:52 -0800
commitd6fab9274521de4c28ede857a61474258bf5f574 (patch)
treea1cc73bc09d7bf5cec1f7a45dd152916a510a4d1 /eclass/multibuild.eclass
parenteclass/multilib-build: multilib_is_best_abi (diff)
downloadgmt-d6fab9274521de4c28ede857a61474258bf5f574.tar.gz
gmt-d6fab9274521de4c28ede857a61474258bf5f574.tar.bz2
gmt-d6fab9274521de4c28ede857a61474258bf5f574.zip
eclass/multi{lib}-build: reimplement multilib_is_best_abi; add multibuild_is_best_variant
Signed-off-by: Gregory M. Tuner <gmt@be-evil.net>
Diffstat (limited to 'eclass/multibuild.eclass')
-rw-r--r--eclass/multibuild.eclass22
1 files changed, 22 insertions, 0 deletions
diff --git a/eclass/multibuild.eclass b/eclass/multibuild.eclass
index 63732ef..382d51d 100644
--- a/eclass/multibuild.eclass
+++ b/eclass/multibuild.eclass
@@ -200,6 +200,28 @@ multibuild_for_best_variant() {
multibuild_foreach_variant "${@}"
}
+# @FUNCTION: multibuild_is_best_variant
+# @DESCRIPTION:
+# Sometimes, while iterating through multibuild variants, we might
+# want to conditionalize some code on whether or not the current
+# variant is the "best" variant, without explicitly needing to
+# invoke multibuild_for_best_variant.
+#
+# Returns zero if and only if the current variant is the same as
+# would be activated by multibuild_for_best_variant.
+multibuild_is_best_variant() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ [[ ${#} -eq 0 ]] || die "${FUNCNAME}: too many arguments"
+ [[ ${MULTIBUILD_VARIANTS} ]] \
+ || die "MULTIBUILD_VARIANTS must be set"
+ [[ ${MULTIBUILD_VARIANT} ]] \
+ || die "MULTIBUILD_VARIANT must be set"
+
+ local best_variant="${MULTIBUILD_VARIANTS[$(( ${#MULTIBUILD_VARIANTS[@]} - 1 ))]}"
+ [[ ${MULTIBUILD_VARIANT} == ${best_variant} ]]
+}
+
# @FUNCTION: multibuild_copy_sources
# @DESCRIPTION:
# Create per-variant copies of source tree. The source tree is assumed