From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-861447-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	by finch.gentoo.org (Postfix) with ESMTP id 27A1658973
	for <garchives@archives.gentoo.org>; Thu,  4 Feb 2016 13:52:06 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 29A9621C018;
	Thu,  4 Feb 2016 13:52:02 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id C371B21C018
	for <gentoo-commits@lists.gentoo.org>; Thu,  4 Feb 2016 13:52:01 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 790CA340A85
	for <gentoo-commits@lists.gentoo.org>; Thu,  4 Feb 2016 13:52:00 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 3021711D
	for <gentoo-commits@lists.gentoo.org>; Thu,  4 Feb 2016 13:51:55 +0000 (UTC)
From: "Fabian Groffen" <grobian@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Fabian Groffen" <grobian@gentoo.org>
Message-ID: <1454593902.ac229ee43b4c0e763d1968a5496490056a5502f7.grobian@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-devel/llvm/
X-VCS-Repository: repo/gentoo
X-VCS-Files: sys-devel/llvm/llvm-3.4.2.ebuild
X-VCS-Directories: sys-devel/llvm/
X-VCS-Committer: grobian
X-VCS-Committer-Name: Fabian Groffen
X-VCS-Revision: ac229ee43b4c0e763d1968a5496490056a5502f7
X-VCS-Branch: master
Date: Thu,  4 Feb 2016 13:51:55 +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
X-Archives-Salt: de84bade-d904-4791-8ceb-86c560848fd9
X-Archives-Hash: dc6c52dd177f29e983dd248349c9b3a1

commit:     ac229ee43b4c0e763d1968a5496490056a5502f7
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Thu Feb  4 13:51:12 2016 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Thu Feb  4 13:51:42 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ac229ee4

sys-devel/llvm: add CHOST-clang wrappers to 3.4.2 too for Prefix bootstrap

Package-Manager: portage-2.2.20-prefix

 sys-devel/llvm/llvm-3.4.2.ebuild | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/sys-devel/llvm/llvm-3.4.2.ebuild b/sys-devel/llvm/llvm-3.4.2.ebuild
index 5268c28..c2ef13a 100644
--- a/sys-devel/llvm/llvm-3.4.2.ebuild
+++ b/sys-devel/llvm/llvm-3.4.2.ebuild
@@ -445,6 +445,34 @@ multilib_src_install() {
 		fi
 	fi
 
+	# apply CHOST and PV to clang executables
+	# they're statically linked so we don't have to worry about the lib
+	if use clang; then
+		local clang_tools=( clang clang++ )
+		local i
+
+		# append ${PV} and symlink back
+		# TODO: use alternatives.eclass? does that make any sense?
+		# maybe with USE=-clang on :0 and USE=clang on older
+		for i in "${clang_tools[@]}"; do
+			mv "${ED%/}/usr/bin/${i}"{,-${PV}} || die
+			dosym "${i}"-${PV} /usr/bin/${i}
+		done
+
+		# now prepend ${CHOST} and let the multilib-build.eclass symlink it
+		if ! multilib_is_native_abi; then
+			# non-native? let's replace it with a simple wrapper
+			for i in "${clang_tools[@]}"; do
+				rm "${ED%/}/usr/bin/${i}-${PV}" || die
+				cat > "${T}"/wrapper.tmp <<-_EOF_
+					#!${EPREFIX}/bin/sh
+					exec "${i}-${PV}" $(get_abi_CFLAGS) "\${@}"
+				_EOF_
+				newbin "${T}"/wrapper.tmp "${i}-${PV}"
+			done
+		fi
+	fi
+
 	# Fix install_names on Darwin.  The build system is too complicated
 	# to just fix this, so we correct it post-install
 	local lib= f= odylib= ndylib= libpv=${PV}