The multilib_get_enabled_abis() returns ${ABI} values only, losing the
information about USE flags. Reverse mapping of those values may
be unclear (two architectures may use the same ABI name), and therefore
the function would to do that would be unnecessarily complex.

Instead, introduce a new function that would return both the USE flags
and the matching ${ABI} value.
---
 eclass/multilib-build.eclass | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/eclass/multilib-build.eclass b/eclass/multilib-build.eclass
index ddf11cc..f369923 100644
--- a/eclass/multilib-build.eclass
+++ b/eclass/multilib-build.eclass
@@ -106,6 +106,21 @@ _multilib_build_set_globals
 multilib_get_enabled_abis() {
        debug-print-function ${FUNCNAME} "${@}"
 
+       local pairs=( $(multilib_get_enabled_abi_pairs) )
+       echo "${pairs[@]#*:}"
+}
+
+# @FUNCTION: multilib_get_enabled_abi_pairs
+# @DESCRIPTION:
+# Return the ordered list of enabled <use-flag>:<ABI> pairs
+# if multilib builds are enabled. The best (most preferred)
+# ABI will come last.
+#
+# If multilib is disabled, the default ABI will be returned
+# along with empty <use-flag>.
+multilib_get_enabled_abi_pairs() {
+       debug-print-function ${FUNCNAME} "${@}"
+
        local abis=( $(get_all_abis) )
 
        local abi i found
@@ -119,7 +134,7 @@ multilib_get_enabled_abis() {
                        # for the split is more complex than cheating like this
                        for m_abi in ${m_abis//,/ }; do
                                if [[ ${m_abi} == ${abi} ]] && use "${m_flag}"; 
then
-                                       echo "${abi}"
+                                       echo "${m_flag}:${abi}"
                                        found=1
                                        break 2
                                fi
@@ -134,7 +149,7 @@ multilib_get_enabled_abis() {
 
                debug-print "${FUNCNAME}: no ABIs enabled, fallback to ${abi}"
                debug-print "${FUNCNAME}: ABI=${ABI}, 
DEFAULT_ABI=${DEFAULT_ABI}"
-               echo ${abi}
+               echo ":${abi}"
        fi
 }
 
-- 
1.9.2


Reply via email to