public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: "Michał Górny" <mgorny@gentoo.org>
Subject: [gentoo-dev] [PATCH 1/2] multilib-build: set MULTILIB_ABI as the 'global' ABI value.
Date: Tue,  2 Apr 2013 23:43:31 +0200	[thread overview]
Message-ID: <1364939012-29714-1-git-send-email-mgorny@gentoo.org> (raw)
In-Reply-To: <20130402234242.5c97d709@pomiocik.lan>

---
 gx86/eclass/multilib-build.eclass | 41 ++++++++++++++++++++++++++++++++++-----
 1 file changed, 36 insertions(+), 5 deletions(-)

diff --git a/gx86/eclass/multilib-build.eclass b/gx86/eclass/multilib-build.eclass
index dbaed70..fdaed6b 100644
--- a/gx86/eclass/multilib-build.eclass
+++ b/gx86/eclass/multilib-build.eclass
@@ -25,10 +25,22 @@ esac
 
 inherit multibuild multilib
 
+# @ECLASS-VARIABLE: MULTILIB_ABI
+# @DEFAULT-UNSET
+# @DESCRIPTION:
+# The current ABI, in form of base arch and sub-ABI, joined using
+# an underscore. It's equal to the flag name with 'abi_' prefix
+# stripped.
+#
+# Exported by multilib_foreach_abi, multilib_parallel_foreach_abi,
+# multilib_for_best_abi.
+#
+# Example values: x86_32, mips_n32
+
 # @ECLASS-VARIABLE: _MULTILIB_FLAGS
 # @INTERNAL
 # @DESCRIPTION:
-# The list of multilib flags and corresponding ABI values.
+# The list of corresponding USE flags and ABI values.
 _MULTILIB_FLAGS=(
 	abi_x86_32:x86
 	abi_x86_64:amd64
@@ -56,6 +68,7 @@ _multilib_build_set_globals() {
 _multilib_build_set_globals
 
 # @FUNCTION: multilib_get_enabled_abis
+# @INTERNAL
 # @DESCRIPTION:
 # Return the ordered list of enabled ABIs if multilib builds
 # are enabled. The best (most preferred) ABI will come last.
@@ -74,7 +87,7 @@ multilib_get_enabled_abis() {
 			local m_flag=${i%:*}
 
 			if [[ ${m_abi} == ${abi} ]] && use "${m_flag}"; then
-				echo "${abi}"
+				echo "${m_flag#abi_}"
 				found=1
 			fi
 		done
@@ -87,7 +100,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 default
 	fi
 }
 
@@ -99,8 +112,26 @@ multilib_get_enabled_abis() {
 _multilib_multibuild_wrapper() {
 	debug-print-function ${FUNCNAME} "${@}"
 
-	local ABI=${MULTIBUILD_VARIANT}
-	multilib_toolchain_setup "${ABI}"
+	local MULTILIB_ABI=${MULTIBUILD_VARIANT}
+	local i
+
+	if [[ ${MULTILIB_ABI} != default ]]; then
+		local ABI
+
+		for i in "${_MULTILIB_FLAGS[@]}"; do
+			local m_abi=${i#*:}
+			local m_flag=${i%:*}
+
+			if [[ ${MULTILIB_ABI} == ${m_flag#abi_} ]]; then
+				local -x ABI=${m_abi}
+				break
+			fi
+		done
+
+		[[ ${ABI} ]] || die "Unable to match ${MULTILIB_ABI} to an ABI!"
+		multilib_toolchain_setup "${ABI}"
+	fi
+
 	"${@}"
 }
 
-- 
1.8.1.5



  reply	other threads:[~2013-04-02 21:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-02 21:42 [gentoo-dev] [PATCHES] multilib-build: use MULTILIB_ABI for eclass-specific ABI value Michał Górny
2013-04-02 21:43 ` Michał Górny [this message]
2013-04-02 21:43 ` [gentoo-dev] [PATCH 2/2] Use MULTILIB_ABI in header wrapping code Michał Górny
2013-04-03  9:40 ` [gentoo-dev] [PATCHES] multilib-build: use MULTILIB_ABI for eclass-specific ABI value Thomas Sachau
2013-04-03  9:40   ` Ciaran McCreesh
2013-04-03  9:52   ` Michał Górny
2013-04-05  3:53   ` Michał Górny
2013-04-05 20:56 ` Michał Górny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1364939012-29714-1-git-send-email-mgorny@gentoo.org \
    --to=mgorny@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox