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}

Reply via email to