commit:     52b4c3988313f8f4875ff6d12236c0b6120bb46f
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Oct  1 06:59:20 2016 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Oct  1 13:05:54 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=52b4c398

sys-devel/llvm: Backport uncond wrapper install to 3.9.0

 sys-devel/llvm/llvm-3.9.0.ebuild | 76 +++++++++++++++++-----------------------
 1 file changed, 33 insertions(+), 43 deletions(-)

diff --git a/sys-devel/llvm/llvm-3.9.0.ebuild b/sys-devel/llvm/llvm-3.9.0.ebuild
index a5269d3..8ead13e 100644
--- a/sys-devel/llvm/llvm-3.9.0.ebuild
+++ b/sys-devel/llvm/llvm-3.9.0.ebuild
@@ -426,18 +426,6 @@ src_install() {
        )
 
        if use clang; then
-               # note: magic applied in multilib_src_install()!
-               CLANG_VERSION=${PV%.*}
-
-               MULTILIB_CHOST_TOOLS+=(
-                       /usr/bin/clang
-                       /usr/bin/clang++
-                       /usr/bin/clang-cl
-                       /usr/bin/clang-${CLANG_VERSION}
-                       /usr/bin/clang++-${CLANG_VERSION}
-                       /usr/bin/clang-cl-${CLANG_VERSION}
-               )
-
                MULTILIB_WRAPPED_HEADERS+=(
                        /usr/include/clang/Config/config.h
                )
@@ -445,29 +433,11 @@ src_install() {
 
        multilib-minimal_src_install
 
-       # Remove unnecessary headers on FreeBSD, bug #417171
-       if use kernel_FreeBSD && use clang; then
-               rm 
"${ED}"usr/lib/clang/${PV}/include/{std,float,iso,limits,tgmath,varargs}*.h || 
die
-       fi
-}
-
-multilib_src_install() {
-       cmake-utils_src_install
-
-       if multilib_is_native_abi; then
-               # Symlink the gold plugin.
-               if use gold; then
-                       dodir "/usr/${CHOST}/binutils-bin/lib/bfd-plugins"
-                       dosym "../../../../$(get_libdir)/LLVMgold.so" \
-                               
"/usr/${CHOST}/binutils-bin/lib/bfd-plugins/LLVMgold.so"
-               fi
-       fi
-
-       # apply CHOST and CLANG_VERSION to clang executables
-       # they're statically linked so we don't have to worry about the lib
        if use clang; then
+               # Apply CHOST and version suffix to clang tools
+               local clang_version=${PV%.*}
                local clang_tools=( clang clang++ clang-cl )
-               local i
+               local abi i
 
                # cmake gives us:
                # - clang-X.Y
@@ -477,24 +447,44 @@ multilib_src_install() {
                # - clang-X.Y
                # - clang++-X.Y, clang-cl-X.Y -> clang-X.Y
                # - clang, clang++, clang-cl -> clang*-X.Y
-               # so we need to fix the two tools
+               # also in CHOST variant
                for i in "${clang_tools[@]:1}"; do
                        rm "${ED%/}/usr/bin/${i}" || die
-                       dosym "clang-${CLANG_VERSION}" 
"/usr/bin/${i}-${CLANG_VERSION}"
-                       dosym "${i}-${CLANG_VERSION}" "/usr/bin/${i}"
+                       dosym "clang-${clang_version}" 
"/usr/bin/${i}-${clang_version}"
+                       dosym "${i}-${clang_version}" "/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
+               # now create wrappers for all supported ABIs
+               for abi in $(get_all_abis); do
+                       local abi_flags=$(get_abi_CFLAGS "${abi}")
+                       local abi_chost=$(get_abi_CHOST "${abi}")
                        for i in "${clang_tools[@]}"; do
-                               rm "${ED%/}/usr/bin/${i}-${CLANG_VERSION}" || 
die
-                               cat > "${T}"/wrapper.tmp <<-_EOF_
+                               cat > "${T}"/wrapper.tmp <<-_EOF_ || die
                                        #!${EPREFIX}/bin/sh
-                                       exec "${i}-${CLANG_VERSION}" 
$(get_abi_CFLAGS) "\${@}"
+                                       exec "${i}-${clang_version}" 
${abi_flags} "\${@}"
                                _EOF_
-                               newbin "${T}"/wrapper.tmp 
"${i}-${CLANG_VERSION}"
+                               newbin "${T}"/wrapper.tmp 
"${abi_chost}-${i}-${clang_version}"
+                               dosym "${abi_chost}-${i}-${clang_version}" \
+                                       "/usr/bin/${abi_chost}-${i}"
                        done
+               done
+       fi
+
+       # Remove unnecessary headers on FreeBSD, bug #417171
+       if use kernel_FreeBSD && use clang; then
+               rm 
"${ED}"usr/lib/clang/${PV}/include/{std,float,iso,limits,tgmath,varargs}*.h || 
die
+       fi
+}
+
+multilib_src_install() {
+       cmake-utils_src_install
+
+       if multilib_is_native_abi; then
+               # Symlink the gold plugin.
+               if use gold; then
+                       dodir "/usr/${CHOST}/binutils-bin/lib/bfd-plugins"
+                       dosym "../../../../$(get_libdir)/LLVMgold.so" \
+                               
"/usr/${CHOST}/binutils-bin/lib/bfd-plugins/LLVMgold.so"
                fi
        fi
 }

Reply via email to