From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org)
	by finch.gentoo.org with esmtp (Exim 4.60)
	(envelope-from <gentoo-commits+bounces-432538-garchives=archives.gentoo.org@lists.gentoo.org>)
	id 1S29PU-0006V4-Ol
	for garchives@archives.gentoo.org; Mon, 27 Feb 2012 22:51:17 +0000
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 414A9E0863;
	Mon, 27 Feb 2012 22:51:00 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	by pigeon.gentoo.org (Postfix) with ESMTP id 11640E0863
	for <gentoo-commits@lists.gentoo.org>; Mon, 27 Feb 2012 22:50:59 +0000 (UTC)
Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163])
	(using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 7792B1B4007
	for <gentoo-commits@lists.gentoo.org>; Mon, 27 Feb 2012 22:50:59 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by hornbill.gentoo.org (Postfix) with ESMTP id 375E9E53FE
	for <gentoo-commits@lists.gentoo.org>; Mon, 27 Feb 2012 22:50:58 +0000 (UTC)
From: "Mike Frysinger" <vapier@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Mike Frysinger" <vapier@gentoo.org>
Message-ID: <1330383022.3e4df184a9626123cf7c0678fc757e399a2af2a1.vapier@gentoo>
Subject: [gentoo-commits] proj/crossdev:master commit in: /
X-VCS-Repository: proj/crossdev
X-VCS-Files: crossdev
X-VCS-Directories: /
X-VCS-Committer: vapier
X-VCS-Committer-Name: Mike Frysinger
X-VCS-Revision: 3e4df184a9626123cf7c0678fc757e399a2af2a1
X-VCS-Branch: master
Date: Mon, 27 Feb 2012 22:50:58 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: quoted-printable
X-Archives-Salt: 7eedb477-b96a-4a8a-b908-d321d8ef8ab9
X-Archives-Hash: ab8d83f6a51af091883cb884b1dc01ea

commit:     3e4df184a9626123cf7c0678fc757e399a2af2a1
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 27 22:50:22 2012 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Mon Feb 27 22:50:22 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=3Dproj/crossdev.git;=
a=3Dcommit;h=3D3e4df184

crossdev: add --show-target-cfg for external toolers

This is meant for other scripts that will be calling crossdev to get
info out of crossdev so they don't have to duplicate tuple maps.

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

---
 crossdev |   33 +++++++++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/crossdev b/crossdev
index 45debb9..27f0a1c 100755
--- a/crossdev
+++ b/crossdev
@@ -69,6 +69,9 @@ Stage Options:
     ${GOOD}-s4, --stage4${NORMAL}            Also build a full compiler =
[default]
                                 (shared libs GCC/various lang frontends/=
etc...)
=20
+External Tooling Options:
+    ${GOOD}--show-target-cfg${NORMAL}        Display target settings tha=
t crossdev will use
+
 Extra Fun (must be run after above stages):
     ${GOOD}--ex-only${NORMAL}                Skip the stage steps above
     ${GOOD}--ex-gcc${NORMAL}                 Build extra gcc targets (gc=
j/ada/etc...)
@@ -474,6 +477,7 @@ EX_GDB=3D"no"
 FORCE=3D"no"
 SET_X=3D"no"
 SHOW_FAIL_LOG=3D"no"
+SHOW_TARGET_CFG=3D"no"
=20
 while [[ $# -gt 0 ]] ; do
 	case $1 in
@@ -508,6 +512,7 @@ while [[ $# -gt 0 ]] ; do
 	--without-*)       eval $(set_withval $1);;
 	-f|--force)        FORCE=3D"yes";;
 	-x)                SET_X=3D"yes";;
+	--show-target-cfg) SHOW_TARGET_CFG=3D"yes";;
 	--show-fail-log)   SHOW_FAIL_LOG=3D"yes";;
 	-P|--portage)      UOPTS=3D"${UOPTS} $2"; shift;;
 	-b|-d|-p|-v|-q)    UOPTS=3D"${UOPTS} $1";;
@@ -531,6 +536,34 @@ for with in HEADERS ; do
 	[[ ${!var} =3D=3D "COW" ]] && eval ${var}=3D${!defvar}
 done
=20
+show_target_cfg() {
+	local pkgs
+
+	pkgs=3D(
+		binutils B
+		gcc G
+		headers K
+		libc L
+	)
+	ex_gdb && pkgs+=3D( gdb D )
+
+	echo "arch ${TARCH}"
+	echo "target ${CTARGET}"
+	echo "category cross-${CTARGET}"
+	while [[ ${#pkgs[@]} -gt 0 ]] ; do
+		local vcat=3D"${pkgs[1]}CAT"
+		local vpkg=3D"${pkgs[1]}PKG"
+
+		if [[ ${!vpkg} !=3D "[none]" ]] ; then
+			echo "${pkgs[0]} ${!vcat} ${!vpkg}"
+		fi
+		pkgs=3D( ${pkgs[@]:2} )
+	done
+
+	exit 0
+}
+[[ ${SHOW_TARGET_CFG} =3D=3D "yes" ]] && show_target_cfg
+
 setup_portage_vars
 if [[ -z ${CROSSDEV_OVERLAY} ]] ; then
 	eerror "You need to specify an output overlay.  Please use --ov-output =
or set"