commit:     b375c11c5cf0467364ff8f217f6de6cc49551d92
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Aug  9 10:31:54 2018 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Aug  9 10:31:54 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b375c11c

sys-libs/libcxx: Use -print-libgcc-file-name to get clang_rt path

Suggested-by: David Carlos Manuelda
Bug: https://bugs.gentoo.org/592326

 sys-libs/libcxx/libcxx-5.0.2.ebuild    | 16 ++++++----------
 sys-libs/libcxx/libcxx-6.0.1.ebuild    | 16 ++++++----------
 sys-libs/libcxx/libcxx-6.0.9999.ebuild | 16 ++++++----------
 sys-libs/libcxx/libcxx-7.0.9999.ebuild | 16 ++++++----------
 sys-libs/libcxx/libcxx-9999.ebuild     | 16 ++++++----------
 5 files changed, 30 insertions(+), 50 deletions(-)

diff --git a/sys-libs/libcxx/libcxx-5.0.2.ebuild 
b/sys-libs/libcxx/libcxx-5.0.2.ebuild
index 885f8b13182..bd65e51b774 100644
--- a/sys-libs/libcxx/libcxx-5.0.2.ebuild
+++ b/sys-libs/libcxx/libcxx-5.0.2.ebuild
@@ -94,16 +94,12 @@ multilib_src_configure() {
                # if we're using libunwind and clang with compiler-rt, we want
                # to link to compiler-rt instead of -lgcc_s
                if tc-is-clang; then
-                       # get the full library list out of 'pretend mode'
-                       # and grep it for libclang_rt references
-                       local args=( $($(tc-getCC) -### -x c - 2>&1 | tail -n 
1) )
-                       local i
-                       for i in "${args[@]}"; do
-                               if [[ ${i} == *libclang_rt* ]]; then
-                                       want_gcc_s=OFF
-                                       extra_libs+=( "${i}" )
-                               fi
-                       done
+                       local compiler_rt=$($(tc-getCC) ${CFLAGS} ${CPPFLAGS} \
+                          ${LDFLAGS} -print-libgcc-file-name)
+                       if [[ ${compiler_rt} == *libclang_rt* ]]; then
+                               want_gcc_s=OFF
+                               extra_libs+=( "${compiler_rt}" )
+                       fi
                fi
        fi
 

diff --git a/sys-libs/libcxx/libcxx-6.0.1.ebuild 
b/sys-libs/libcxx/libcxx-6.0.1.ebuild
index b7dda42427a..6c5c866f9c6 100644
--- a/sys-libs/libcxx/libcxx-6.0.1.ebuild
+++ b/sys-libs/libcxx/libcxx-6.0.1.ebuild
@@ -101,16 +101,12 @@ multilib_src_configure() {
                # if we're using libunwind and clang with compiler-rt, we want
                # to link to compiler-rt instead of -lgcc_s
                if tc-is-clang; then
-                       # get the full library list out of 'pretend mode'
-                       # and grep it for libclang_rt references
-                       local args=( $($(tc-getCC) -### -x c - 2>&1 | tail -n 
1) )
-                       local i
-                       for i in "${args[@]}"; do
-                               if [[ ${i} == *libclang_rt* ]]; then
-                                       want_gcc_s=OFF
-                                       extra_libs+=( "${i}" )
-                               fi
-                       done
+                       local compiler_rt=$($(tc-getCC) ${CFLAGS} ${CPPFLAGS} \
+                          ${LDFLAGS} -print-libgcc-file-name)
+                       if [[ ${compiler_rt} == *libclang_rt* ]]; then
+                               want_gcc_s=OFF
+                               extra_libs+=( "${compiler_rt}" )
+                       fi
                fi
        fi
 

diff --git a/sys-libs/libcxx/libcxx-6.0.9999.ebuild 
b/sys-libs/libcxx/libcxx-6.0.9999.ebuild
index 7454f776ff6..8b1b4efcd6e 100644
--- a/sys-libs/libcxx/libcxx-6.0.9999.ebuild
+++ b/sys-libs/libcxx/libcxx-6.0.9999.ebuild
@@ -113,16 +113,12 @@ multilib_src_configure() {
                # if we're using libunwind and clang with compiler-rt, we want
                # to link to compiler-rt instead of -lgcc_s
                if tc-is-clang; then
-                       # get the full library list out of 'pretend mode'
-                       # and grep it for libclang_rt references
-                       local args=( $($(tc-getCC) -### -x c - 2>&1 | tail -n 
1) )
-                       local i
-                       for i in "${args[@]}"; do
-                               if [[ ${i} == *libclang_rt* ]]; then
-                                       want_gcc_s=OFF
-                                       extra_libs+=( "${i}" )
-                               fi
-                       done
+                       local compiler_rt=$($(tc-getCC) ${CFLAGS} ${CPPFLAGS} \
+                          ${LDFLAGS} -print-libgcc-file-name)
+                       if [[ ${compiler_rt} == *libclang_rt* ]]; then
+                               want_gcc_s=OFF
+                               extra_libs+=( "${compiler_rt}" )
+                       fi
                fi
        fi
 

diff --git a/sys-libs/libcxx/libcxx-7.0.9999.ebuild 
b/sys-libs/libcxx/libcxx-7.0.9999.ebuild
index 64bc9accf26..e5777074eed 100644
--- a/sys-libs/libcxx/libcxx-7.0.9999.ebuild
+++ b/sys-libs/libcxx/libcxx-7.0.9999.ebuild
@@ -113,16 +113,12 @@ multilib_src_configure() {
                # if we're using libunwind and clang with compiler-rt, we want
                # to link to compiler-rt instead of -lgcc_s
                if tc-is-clang; then
-                       # get the full library list out of 'pretend mode'
-                       # and grep it for libclang_rt references
-                       local args=( $($(tc-getCC) -### -x c - 2>&1 | tail -n 
1) )
-                       local i
-                       for i in "${args[@]}"; do
-                               if [[ ${i} == *libclang_rt* ]]; then
-                                       want_gcc_s=OFF
-                                       extra_libs+=( "${i}" )
-                               fi
-                       done
+                       local compiler_rt=$($(tc-getCC) ${CFLAGS} ${CPPFLAGS} \
+                          ${LDFLAGS} -print-libgcc-file-name)
+                       if [[ ${compiler_rt} == *libclang_rt* ]]; then
+                               want_gcc_s=OFF
+                               extra_libs+=( "${compiler_rt}" )
+                       fi
                fi
        fi
 

diff --git a/sys-libs/libcxx/libcxx-9999.ebuild 
b/sys-libs/libcxx/libcxx-9999.ebuild
index a4fdb61c8c7..4272b211794 100644
--- a/sys-libs/libcxx/libcxx-9999.ebuild
+++ b/sys-libs/libcxx/libcxx-9999.ebuild
@@ -112,16 +112,12 @@ multilib_src_configure() {
                # if we're using libunwind and clang with compiler-rt, we want
                # to link to compiler-rt instead of -lgcc_s
                if tc-is-clang; then
-                       # get the full library list out of 'pretend mode'
-                       # and grep it for libclang_rt references
-                       local args=( $($(tc-getCC) -### -x c - 2>&1 | tail -n 
1) )
-                       local i
-                       for i in "${args[@]}"; do
-                               if [[ ${i} == *libclang_rt* ]]; then
-                                       want_gcc_s=OFF
-                                       extra_libs+=( "${i}" )
-                               fi
-                       done
+                       local compiler_rt=$($(tc-getCC) ${CFLAGS} ${CPPFLAGS} \
+                          ${LDFLAGS} -print-libgcc-file-name)
+                       if [[ ${compiler_rt} == *libclang_rt* ]]; then
+                               want_gcc_s=OFF
+                               extra_libs+=( "${compiler_rt}" )
+                       fi
                fi
        fi
 

Reply via email to