This time, following suggestions from Alexis Ballier, the complete list of USE flags and corresponding ABIs is stored in a single variable. I have removed the arch hack and all selected ABIs are validated against $(get_all_abis) from multilib.eclass. --- gx86/eclass/multilib-build.eclass | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-)
diff --git a/gx86/eclass/multilib-build.eclass b/gx86/eclass/multilib-build.eclass index 20d4f1c..a6104e0 100644 --- a/gx86/eclass/multilib-build.eclass +++ b/gx86/eclass/multilib-build.eclass @@ -25,7 +25,14 @@ esac inherit multilib multiprocessing -IUSE=multilib +# @ECLASS-VARIABLE: _MULTILIB_FLAGS +# @INTERNAL +# @DESCRIPTION: +# The list of multilib flags and corresponding ABI values. +_MULTILIB_FLAGS=( + abi_x86_32:x86 + abi_x86_64:amd64 +) # @ECLASS-VARIABLE: MULTILIB_USEDEP # @DESCRIPTION: @@ -37,7 +44,15 @@ IUSE=multilib # RDEPEND="dev-libs/libfoo[${MULTILIB_USEDEP}] # net-libs/libbar[ssl,${MULTILIB_USEDEP}]" # @CODE -MULTILIB_USEDEP='multilib(-)?' + +_multilib_build_set_globals() { + local flags=( "${_MULTILIB_FLAGS[@]%:*}" ) + local usedeps=${flags[@]/%/(-)?} + + IUSE=${flags[*]} + MULTILIB_USEDEP=${usedeps// /,} +} +_multilib_build_set_globals # @FUNCTION: multilib_get_enabled_abis # @DESCRIPTION: @@ -49,9 +64,20 @@ MULTILIB_USEDEP='multilib(-)?' multilib_get_enabled_abis() { debug-print-function ${FUNCNAME} "${@}" - if use multilib; then - get_all_abis - else + local supported_abis=$(get_all_abis) + local i found + for i in "${_MULTILIB_FLAGS[@]}"; do + local abi=${i#*:} + local flag=${i%:*} + + if has "${abi}" ${supported_abis} && use "${flag}"; then + echo "${abi}" + found=1 + fi + done + + if [[ ! ${found} ]]; then + debug-print "${FUNCNAME}: no ABIs enabled, fallback to ${DEFAULT_ABI}" echo ${DEFAULT_ABI} fi } -- 1.8.1.1