diff options
30 files changed, 204 insertions, 308 deletions
diff --git a/eclass/tests/toolchain-funcs.sh b/eclass/tests/toolchain-funcs.sh index 56379b10cded..08cfd74611aa 100755 --- a/eclass/tests/toolchain-funcs.sh +++ b/eclass/tests/toolchain-funcs.sh @@ -60,20 +60,22 @@ tbegin "tc-ld-is-gold (ld=bfd cc=bfd)" LD=ld.bfd LDFLAGS=-fuse-ld=bfd tc-ld-is-gold && ret=1 || ret=0 tend ${ret} -tbegin "tc-ld-is-gold (ld=gold cc=default)" -LD=ld.gold tc-ld-is-gold -ret=$? -tend ${ret} - -tbegin "tc-ld-is-gold (ld=gold cc=bfd)" -LD=ld.gold LDFLAGS=-fuse-ld=bfd tc-ld-is-gold -ret=$? -tend ${ret} - -tbegin "tc-ld-is-gold (ld=bfd cc=gold)" -LD=ld.bfd LDFLAGS=-fuse-ld=gold tc-ld-is-gold -ret=$? -tend ${ret} +if type -P ld.gold &>/dev/null; then + tbegin "tc-ld-is-gold (ld=gold cc=default)" + LD=ld.gold tc-ld-is-gold + ret=$? + tend ${ret} + + tbegin "tc-ld-is-gold (ld=gold cc=bfd)" + LD=ld.gold LDFLAGS=-fuse-ld=bfd tc-ld-is-gold + ret=$? + tend ${ret} + + tbegin "tc-ld-is-gold (ld=bfd cc=gold)" + LD=ld.bfd LDFLAGS=-fuse-ld=gold tc-ld-is-gold + ret=$? + tend ${ret} +fi # # TEST: tc-ld-disable-gold @@ -87,23 +89,25 @@ tc-ld-disable-gold ) tend $? -tbegin "tc-ld-disable-gold (ld=gold)" -( -export LD=ld.gold LDFLAGS= -ewarn() { :; } -tc-ld-disable-gold -[[ ${LD} == "ld.bfd" || ${LDFLAGS} == *"-fuse-ld=bfd"* ]] -) -tend $? +if type -P ld.gold &>/dev/null; then + tbegin "tc-ld-disable-gold (ld=gold)" + ( + export LD=ld.gold LDFLAGS= + ewarn() { :; } + tc-ld-disable-gold + [[ ${LD} == "ld.bfd" || ${LDFLAGS} == *"-fuse-ld=bfd"* ]] + ) + tend $? -tbegin "tc-ld-disable-gold (cc=gold)" -( -export LD= LDFLAGS="-fuse-ld=gold" -ewarn() { :; } -tc-ld-disable-gold -[[ ${LD} == *"/ld.bfd" || ${LDFLAGS} == "-fuse-ld=gold -fuse-ld=bfd" ]] -) -tend $? + tbegin "tc-ld-disable-gold (cc=gold)" + ( + export LD= LDFLAGS="-fuse-ld=gold" + ewarn() { :; } + tc-ld-disable-gold + [[ ${LD} == *"/ld.bfd" || ${LDFLAGS} == "-fuse-ld=gold -fuse-ld=bfd" ]] + ) + tend $? +fi unset CPP @@ -198,4 +202,36 @@ for compiler in gcc clang not-really-a-compiler; do fi done +if type -P gcc &>/dev/null; then + tbegin "tc-get-cxx-stdlib (gcc)" + [[ $(CXX=g++ tc-get-cxx-stdlib) == libstdc++ ]] + tend $? + + tbegin "tc-get-c-rtlib (gcc)" + [[ $(CC=gcc tc-get-c-rtlib) == libgcc ]] + tend $? +fi + +if type -P clang &>/dev/null; then + for stdlib in libc++ libstdc++; do + if clang++ -stdlib=${stdlib} -x c++ -E -P - &>/dev/null \ + <<<'#include <ciso646>' + then + tbegin "tc-get-cxx-stdlib (clang, ${stdlib})" + [[ $(CXX=clang++ CXXFLAGS="-stdlib=${stdlib}" tc-get-cxx-stdlib) == ${stdlib} ]] + tend $? + fi + done + + tbegin "tc-get-cxx-stdlib (clang, invalid)" + ! CXX=clang++ CXXFLAGS="-stdlib=invalid" tc-get-cxx-stdlib + tend $? + + for rtlib in compiler-rt libgcc; do + tbegin "tc-get-c-rtlib (clang, ${rtlib})" + [[ $(CC=clang CFLAGS="--rtlib=${rtlib}" tc-get-c-rtlib) == ${rtlib} ]] + tend $? + done +fi + texit diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass index 48bf11606c4a..32e446cb2368 100644 --- a/eclass/toolchain-funcs.eclass +++ b/eclass/toolchain-funcs.eclass @@ -1173,4 +1173,68 @@ gen_usr_ldscript() { done } +# @FUNCTION: tc-get-cxx-stdlib +# @DESCRIPTION: +# Attempt to identify the C++ standard library used by the compiler. +# If the library is identified, the function returns 0 and prints one +# of the following: +# +# - ``libc++`` for ``sys-libs/libcxx`` +# - ``libstdc++`` for ``sys-devel/gcc``'s libstdc++ +# +# If the library is not recognized, the function returns 1. +tc-get-cxx-stdlib() { + local code='#include <ciso646> + +#if defined(_LIBCPP_VERSION) + HAVE_LIBCXX +#elif defined(__GLIBCXX__) + HAVE_LIBSTDCPP +#endif +' + local res=$( + $(tc-getCXX) ${CXXFLAGS} ${CPPFLAGS} -x c++ -E -P - \ + <<<"${code}" 2>/dev/null + ) + + case ${res} in + *HAVE_LIBCXX*) + echo libc++;; + *HAVE_LIBSTDCPP*) + echo libstdc++;; + *) + return 1;; + esac + + return 0 +} + +# @FUNCTION: tc-get-c-rtlib +# @DESCRIPTION: +# Attempt to identify the runtime used by the C/C++ compiler. +# If the runtime is identifed, the function returns 0 and prints one +# of the following: +# +# - ``compiler-rt`` for ``sys-libs/compiler-rt`` +# - ``libgcc`` for ``sys-devel/gcc``'s libgcc +# +# If the runtime is not recognized, the function returns 1. +tc-get-c-rtlib() { + local res=$( + $(tc-getCC) ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} \ + -print-libgcc-file-name 2>/dev/null + ) + + case ${res} in + *libclang_rt*) + echo compiler-rt;; + *libgcc*) + echo libgcc;; + *) + return 1;; + esac + + return 0 +} + fi diff --git a/sys-devel/llvm/llvm-13.0.1.ebuild b/sys-devel/llvm/llvm-13.0.1.ebuild index 2d52bf8cfe60..598476d25566 100644 --- a/sys-devel/llvm/llvm-13.0.1.ebuild +++ b/sys-devel/llvm/llvm-13.0.1.ebuild @@ -174,18 +174,6 @@ src_prepare() { llvm.org_src_prepare } -# Is LLVM being linked against libc++? -is_libcxx_linked() { - local code='#include <ciso646> -#if defined(_LIBCPP_VERSION) - HAVE_LIBCXX -#endif -' - local out=$($(tc-getCXX) ${CXXFLAGS} ${CPPFLAGS} -x c++ -E -P - <<<"${code}") || return 1 - - [[ ${out} == *HAVE_LIBCXX* ]] -} - get_distribution_components() { local sep=${1-;} @@ -367,7 +355,7 @@ multilib_src_configure() { -DOCAMLFIND=NO ) - if is_libcxx_linked; then + if [[ $(tc-get-cxx-stdlib) == libc++ ]]; then # Smart hack: alter version suffix -> SOVERSION when linking # against libc++. This way we won't end up mixing LLVM libc++ # libraries with libstdc++ clang, and the other way around. diff --git a/sys-devel/llvm/llvm-14.0.6-r2.ebuild b/sys-devel/llvm/llvm-14.0.6-r2.ebuild index 01b9bbfd4b9d..0f53397cf7ae 100644 --- a/sys-devel/llvm/llvm-14.0.6-r2.ebuild +++ b/sys-devel/llvm/llvm-14.0.6-r2.ebuild @@ -186,18 +186,6 @@ src_prepare() { rm test/Other/ChangePrinters/DotCfg/print-changed-dot-cfg.ll || die } -# Is LLVM being linked against libc++? -is_libcxx_linked() { - local code='#include <ciso646> -#if defined(_LIBCPP_VERSION) - HAVE_LIBCXX -#endif -' - local out=$($(tc-getCXX) ${CXXFLAGS} ${CPPFLAGS} -x c++ -E -P - <<<"${code}") || return 1 - - [[ ${out} == *HAVE_LIBCXX* ]] -} - get_distribution_components() { local sep=${1-;} @@ -381,7 +369,7 @@ multilib_src_configure() { -DOCAMLFIND=NO ) - if is_libcxx_linked; then + if [[ $(tc-get-cxx-stdlib) == libc++ ]]; then # Smart hack: alter version suffix -> SOVERSION when linking # against libc++. This way we won't end up mixing LLVM libc++ # libraries with libstdc++ clang, and the other way around. diff --git a/sys-devel/llvm/llvm-15.0.2.ebuild b/sys-devel/llvm/llvm-15.0.2.ebuild index 5f8f61bdd695..79d2ff39fb45 100644 --- a/sys-devel/llvm/llvm-15.0.2.ebuild +++ b/sys-devel/llvm/llvm-15.0.2.ebuild @@ -180,18 +180,6 @@ src_prepare() { llvm.org_src_prepare } -# Is LLVM being linked against libc++? -is_libcxx_linked() { - local code='#include <ciso646> -#if defined(_LIBCPP_VERSION) - HAVE_LIBCXX -#endif -' - local out=$($(tc-getCXX) ${CXXFLAGS} ${CPPFLAGS} -x c++ -E -P - <<<"${code}") || return 1 - - [[ ${out} == *HAVE_LIBCXX* ]] -} - get_distribution_components() { local sep=${1-;} @@ -379,7 +367,7 @@ multilib_src_configure() { -DOCAMLFIND=NO ) - if is_libcxx_linked; then + if [[ $(tc-get-cxx-stdlib) == libc++ ]]; then # Smart hack: alter version suffix -> SOVERSION when linking # against libc++. This way we won't end up mixing LLVM libc++ # libraries with libstdc++ clang, and the other way around. diff --git a/sys-devel/llvm/llvm-15.0.3.9999.ebuild b/sys-devel/llvm/llvm-15.0.3.9999.ebuild index 010e27a1349e..1f47134cba77 100644 --- a/sys-devel/llvm/llvm-15.0.3.9999.ebuild +++ b/sys-devel/llvm/llvm-15.0.3.9999.ebuild @@ -180,18 +180,6 @@ src_prepare() { llvm.org_src_prepare } -# Is LLVM being linked against libc++? -is_libcxx_linked() { - local code='#include <ciso646> -#if defined(_LIBCPP_VERSION) - HAVE_LIBCXX -#endif -' - local out=$($(tc-getCXX) ${CXXFLAGS} ${CPPFLAGS} -x c++ -E -P - <<<"${code}") || return 1 - - [[ ${out} == *HAVE_LIBCXX* ]] -} - get_distribution_components() { local sep=${1-;} @@ -379,7 +367,7 @@ multilib_src_configure() { -DOCAMLFIND=NO ) - if is_libcxx_linked; then + if [[ $(tc-get-cxx-stdlib) == libc++ ]]; then # Smart hack: alter version suffix -> SOVERSION when linking # against libc++. This way we won't end up mixing LLVM libc++ # libraries with libstdc++ clang, and the other way around. diff --git a/sys-devel/llvm/llvm-16.0.0.9999.ebuild b/sys-devel/llvm/llvm-16.0.0.9999.ebuild index 946713e022db..4eebbc15117c 100644 --- a/sys-devel/llvm/llvm-16.0.0.9999.ebuild +++ b/sys-devel/llvm/llvm-16.0.0.9999.ebuild @@ -184,18 +184,6 @@ src_prepare() { llvm.org_src_prepare } -# Is LLVM being linked against libc++? -is_libcxx_linked() { - local code='#include <ciso646> -#if defined(_LIBCPP_VERSION) - HAVE_LIBCXX -#endif -' - local out=$($(tc-getCXX) ${CXXFLAGS} ${CPPFLAGS} -x c++ -E -P - <<<"${code}") || return 1 - - [[ ${out} == *HAVE_LIBCXX* ]] -} - get_distribution_components() { local sep=${1-;} @@ -391,7 +379,7 @@ multilib_src_configure() { # the commit id in the SOVERSION to contain the breakage suffix+="git${EGIT_VERSION::8}" fi - if is_libcxx_linked; then + if [[ $(tc-get-cxx-stdlib) == libc++ ]]; then # Smart hack: alter version suffix -> SOVERSION when linking # against libc++. This way we won't end up mixing LLVM libc++ # libraries with libstdc++ clang, and the other way around. diff --git a/sys-devel/llvm/llvm-16.0.0_pre20221006.ebuild b/sys-devel/llvm/llvm-16.0.0_pre20221006.ebuild index fef201259b9f..91463ab2ffbd 100644 --- a/sys-devel/llvm/llvm-16.0.0_pre20221006.ebuild +++ b/sys-devel/llvm/llvm-16.0.0_pre20221006.ebuild @@ -184,18 +184,6 @@ src_prepare() { llvm.org_src_prepare } -# Is LLVM being linked against libc++? -is_libcxx_linked() { - local code='#include <ciso646> -#if defined(_LIBCPP_VERSION) - HAVE_LIBCXX -#endif -' - local out=$($(tc-getCXX) ${CXXFLAGS} ${CPPFLAGS} -x c++ -E -P - <<<"${code}") || return 1 - - [[ ${out} == *HAVE_LIBCXX* ]] -} - get_distribution_components() { local sep=${1-;} @@ -391,7 +379,7 @@ multilib_src_configure() { # the commit id in the SOVERSION to contain the breakage suffix+="git${EGIT_VERSION::8}" fi - if is_libcxx_linked; then + if [[ $(tc-get-cxx-stdlib) == libc++ ]]; then # Smart hack: alter version suffix -> SOVERSION when linking # against libc++. This way we won't end up mixing LLVM libc++ # libraries with libstdc++ clang, and the other way around. diff --git a/sys-devel/llvm/llvm-16.0.0_pre20221010.ebuild b/sys-devel/llvm/llvm-16.0.0_pre20221010.ebuild index 946713e022db..4eebbc15117c 100644 --- a/sys-devel/llvm/llvm-16.0.0_pre20221010.ebuild +++ b/sys-devel/llvm/llvm-16.0.0_pre20221010.ebuild @@ -184,18 +184,6 @@ src_prepare() { llvm.org_src_prepare } -# Is LLVM being linked against libc++? -is_libcxx_linked() { - local code='#include <ciso646> -#if defined(_LIBCPP_VERSION) - HAVE_LIBCXX -#endif -' - local out=$($(tc-getCXX) ${CXXFLAGS} ${CPPFLAGS} -x c++ -E -P - <<<"${code}") || return 1 - - [[ ${out} == *HAVE_LIBCXX* ]] -} - get_distribution_components() { local sep=${1-;} @@ -391,7 +379,7 @@ multilib_src_configure() { # the commit id in the SOVERSION to contain the breakage suffix+="git${EGIT_VERSION::8}" fi - if is_libcxx_linked; then + if [[ $(tc-get-cxx-stdlib) == libc++ ]]; then # Smart hack: alter version suffix -> SOVERSION when linking # against libc++. This way we won't end up mixing LLVM libc++ # libraries with libstdc++ clang, and the other way around. diff --git a/sys-libs/libcxx/libcxx-13.0.1.ebuild b/sys-libs/libcxx/libcxx-13.0.1.ebuild index f7db45b21571..3021d859b872 100644 --- a/sys-libs/libcxx/libcxx-13.0.1.ebuild +++ b/sys-libs/libcxx/libcxx-13.0.1.ebuild @@ -89,14 +89,10 @@ multilib_src_configure() { extra_libs+=( -lunwind ) # 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 - local compiler_rt=$($(tc-getCC) ${CFLAGS} ${CPPFLAGS} \ - ${LDFLAGS} -print-libgcc-file-name) - if [[ ${compiler_rt} == *libclang_rt* ]]; then - want_gcc_s=OFF - want_compiler_rt=ON - extra_libs+=( "${compiler_rt}" ) - fi + if [[ $(tc-get-c-rtlib) == compiler-rt ]]; then + want_gcc_s=OFF + want_compiler_rt=ON + extra_libs+=( "${compiler_rt}" ) fi elif [[ ${CHOST} == *-darwin* ]] && tc-is-clang; then # clang-based darwin prefix disables libunwind useflag during diff --git a/sys-libs/libcxx/libcxx-14.0.6.ebuild b/sys-libs/libcxx/libcxx-14.0.6.ebuild index 47501e5ea293..063546f816be 100644 --- a/sys-libs/libcxx/libcxx-14.0.6.ebuild +++ b/sys-libs/libcxx/libcxx-14.0.6.ebuild @@ -97,14 +97,10 @@ multilib_src_configure() { extra_libs+=( -lunwind ) # 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 - local compiler_rt=$($(tc-getCC) ${CFLAGS} ${CPPFLAGS} \ - ${LDFLAGS} -print-libgcc-file-name) - if [[ ${compiler_rt} == *libclang_rt* ]]; then - want_gcc_s=OFF - want_compiler_rt=ON - extra_libs+=( "${compiler_rt}" ) - fi + if [[ $(tc-get-c-rtlib) == compiler-rt ]]; then + want_gcc_s=OFF + want_compiler_rt=ON + extra_libs+=( "${compiler_rt}" ) fi elif [[ ${CHOST} == *-darwin* ]] && tc-is-clang; then # clang-based darwin prefix disables libunwind useflag during diff --git a/sys-libs/libcxx/libcxx-15.0.2.ebuild b/sys-libs/libcxx/libcxx-15.0.2.ebuild index 79e6aec88593..275d229a612a 100644 --- a/sys-libs/libcxx/libcxx-15.0.2.ebuild +++ b/sys-libs/libcxx/libcxx-15.0.2.ebuild @@ -95,15 +95,9 @@ multilib_src_configure() { strip-unsupported-flags fi - # link against compiler-rt instead of libgcc if this is what clang does - local want_compiler_rt=OFF - if tc-is-clang; then - local compiler_rt=$($(tc-getCC) ${CFLAGS} ${CPPFLAGS} \ - ${LDFLAGS} -print-libgcc-file-name) - if [[ ${compiler_rt} == *libclang_rt* ]]; then - want_compiler_rt=ON - fi - fi + # link to compiler-rt + local use_compiler_rt=OFF + [[ $(tc-get-c-rtlib) == compiler-rt ]] && use_compiler_rt=ON # bootstrap: cmake is unhappy if compiler can't link to stdlib local nolib_flags=( -nodefaultlibs -lc ) @@ -131,7 +125,7 @@ multilib_src_configure() { -DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl) -DLIBCXX_INCLUDE_BENCHMARKS=OFF -DLIBCXX_INCLUDE_TESTS=$(usex test) - -DLIBCXX_USE_COMPILER_RT=${want_compiler_rt} + -DLIBCXX_USE_COMPILER_RT=${use_compiler_rt} ) if use test; then diff --git a/sys-libs/libcxx/libcxx-15.0.3.9999.ebuild b/sys-libs/libcxx/libcxx-15.0.3.9999.ebuild index c28920c09043..6bcf1a20c831 100644 --- a/sys-libs/libcxx/libcxx-15.0.3.9999.ebuild +++ b/sys-libs/libcxx/libcxx-15.0.3.9999.ebuild @@ -94,15 +94,9 @@ multilib_src_configure() { strip-unsupported-flags fi - # link against compiler-rt instead of libgcc if this is what clang does - local want_compiler_rt=OFF - if tc-is-clang; then - local compiler_rt=$($(tc-getCC) ${CFLAGS} ${CPPFLAGS} \ - ${LDFLAGS} -print-libgcc-file-name) - if [[ ${compiler_rt} == *libclang_rt* ]]; then - want_compiler_rt=ON - fi - fi + # link to compiler-rt + local use_compiler_rt=OFF + [[ $(tc-get-c-rtlib) == compiler-rt ]] && use_compiler_rt=ON # bootstrap: cmake is unhappy if compiler can't link to stdlib local nolib_flags=( -nodefaultlibs -lc ) @@ -130,7 +124,7 @@ multilib_src_configure() { -DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl) -DLIBCXX_INCLUDE_BENCHMARKS=OFF -DLIBCXX_INCLUDE_TESTS=$(usex test) - -DLIBCXX_USE_COMPILER_RT=${want_compiler_rt} + -DLIBCXX_USE_COMPILER_RT=${use_compiler_rt} ) if use test; then diff --git a/sys-libs/libcxx/libcxx-16.0.0.9999.ebuild b/sys-libs/libcxx/libcxx-16.0.0.9999.ebuild index c28920c09043..6bcf1a20c831 100644 --- a/sys-libs/libcxx/libcxx-16.0.0.9999.ebuild +++ b/sys-libs/libcxx/libcxx-16.0.0.9999.ebuild @@ -94,15 +94,9 @@ multilib_src_configure() { strip-unsupported-flags fi - # link against compiler-rt instead of libgcc if this is what clang does - local want_compiler_rt=OFF - if tc-is-clang; then - local compiler_rt=$($(tc-getCC) ${CFLAGS} ${CPPFLAGS} \ - ${LDFLAGS} -print-libgcc-file-name) - if [[ ${compiler_rt} == *libclang_rt* ]]; then - want_compiler_rt=ON - fi - fi + # link to compiler-rt + local use_compiler_rt=OFF + [[ $(tc-get-c-rtlib) == compiler-rt ]] && use_compiler_rt=ON # bootstrap: cmake is unhappy if compiler can't link to stdlib local nolib_flags=( -nodefaultlibs -lc ) @@ -130,7 +124,7 @@ multilib_src_configure() { -DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl) -DLIBCXX_INCLUDE_BENCHMARKS=OFF -DLIBCXX_INCLUDE_TESTS=$(usex test) - -DLIBCXX_USE_COMPILER_RT=${want_compiler_rt} + -DLIBCXX_USE_COMPILER_RT=${use_compiler_rt} ) if use test; then diff --git a/sys-libs/libcxx/libcxx-16.0.0_pre20221006.ebuild b/sys-libs/libcxx/libcxx-16.0.0_pre20221006.ebuild index c28920c09043..6bcf1a20c831 100644 --- a/sys-libs/libcxx/libcxx-16.0.0_pre20221006.ebuild +++ b/sys-libs/libcxx/libcxx-16.0.0_pre20221006.ebuild @@ -94,15 +94,9 @@ multilib_src_configure() { strip-unsupported-flags fi - # link against compiler-rt instead of libgcc if this is what clang does - local want_compiler_rt=OFF - if tc-is-clang; then - local compiler_rt=$($(tc-getCC) ${CFLAGS} ${CPPFLAGS} \ - ${LDFLAGS} -print-libgcc-file-name) - if [[ ${compiler_rt} == *libclang_rt* ]]; then - want_compiler_rt=ON - fi - fi + # link to compiler-rt + local use_compiler_rt=OFF + [[ $(tc-get-c-rtlib) == compiler-rt ]] && use_compiler_rt=ON # bootstrap: cmake is unhappy if compiler can't link to stdlib local nolib_flags=( -nodefaultlibs -lc ) @@ -130,7 +124,7 @@ multilib_src_configure() { -DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl) -DLIBCXX_INCLUDE_BENCHMARKS=OFF -DLIBCXX_INCLUDE_TESTS=$(usex test) - -DLIBCXX_USE_COMPILER_RT=${want_compiler_rt} + -DLIBCXX_USE_COMPILER_RT=${use_compiler_rt} ) if use test; then diff --git a/sys-libs/libcxx/libcxx-16.0.0_pre20221010.ebuild b/sys-libs/libcxx/libcxx-16.0.0_pre20221010.ebuild index c28920c09043..6bcf1a20c831 100644 --- a/sys-libs/libcxx/libcxx-16.0.0_pre20221010.ebuild +++ b/sys-libs/libcxx/libcxx-16.0.0_pre20221010.ebuild @@ -94,15 +94,9 @@ multilib_src_configure() { strip-unsupported-flags fi - # link against compiler-rt instead of libgcc if this is what clang does - local want_compiler_rt=OFF - if tc-is-clang; then - local compiler_rt=$($(tc-getCC) ${CFLAGS} ${CPPFLAGS} \ - ${LDFLAGS} -print-libgcc-file-name) - if [[ ${compiler_rt} == *libclang_rt* ]]; then - want_compiler_rt=ON - fi - fi + # link to compiler-rt + local use_compiler_rt=OFF + [[ $(tc-get-c-rtlib) == compiler-rt ]] && use_compiler_rt=ON # bootstrap: cmake is unhappy if compiler can't link to stdlib local nolib_flags=( -nodefaultlibs -lc ) @@ -130,7 +124,7 @@ multilib_src_configure() { -DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl) -DLIBCXX_INCLUDE_BENCHMARKS=OFF -DLIBCXX_INCLUDE_TESTS=$(usex test) - -DLIBCXX_USE_COMPILER_RT=${want_compiler_rt} + -DLIBCXX_USE_COMPILER_RT=${use_compiler_rt} ) if use test; then diff --git a/sys-libs/libcxxabi/libcxxabi-13.0.1.ebuild b/sys-libs/libcxxabi/libcxxabi-13.0.1.ebuild index b49532e94b6d..b2fcf26fc7f0 100644 --- a/sys-libs/libcxxabi/libcxxabi-13.0.1.ebuild +++ b/sys-libs/libcxxabi/libcxxabi-13.0.1.ebuild @@ -53,12 +53,8 @@ multilib_src_configure() { # link against compiler-rt instead of libgcc if we are using clang with libunwind local want_compiler_rt=OFF - if use libunwind && tc-is-clang; then - local compiler_rt=$($(tc-getCC) ${CFLAGS} ${CPPFLAGS} \ - ${LDFLAGS} -print-libgcc-file-name) - if [[ ${compiler_rt} == *libclang_rt* ]]; then - want_compiler_rt=ON - fi + if use libunwind && [[ $(tc-get-c-rtlib) == compiler-rt ]]; then + want_compiler_rt=ON fi local libdir=$(get_libdir) diff --git a/sys-libs/libcxxabi/libcxxabi-14.0.6.ebuild b/sys-libs/libcxxabi/libcxxabi-14.0.6.ebuild index 1aa08e4c22f1..f88c43716406 100644 --- a/sys-libs/libcxxabi/libcxxabi-14.0.6.ebuild +++ b/sys-libs/libcxxabi/libcxxabi-14.0.6.ebuild @@ -59,12 +59,8 @@ pkg_setup() { multilib_src_configure() { # link against compiler-rt instead of libgcc if we are using clang with libunwind local want_compiler_rt=OFF - if use libunwind && tc-is-clang; then - local compiler_rt=$($(tc-getCC) ${CFLAGS} ${CPPFLAGS} \ - ${LDFLAGS} -print-libgcc-file-name) - if [[ ${compiler_rt} == *libclang_rt* ]]; then - want_compiler_rt=ON - fi + if use libunwind && [[ $(tc-get-c-rtlib) == compiler-rt ]]; then + want_compiler_rt=ON fi local libdir=$(get_libdir) diff --git a/sys-libs/libcxxabi/libcxxabi-15.0.2.ebuild b/sys-libs/libcxxabi/libcxxabi-15.0.2.ebuild index 5665bc0cb12f..d9a53ffa7084 100644 --- a/sys-libs/libcxxabi/libcxxabi-15.0.2.ebuild +++ b/sys-libs/libcxxabi/libcxxabi-15.0.2.ebuild @@ -63,15 +63,9 @@ multilib_src_configure() { strip-unsupported-flags fi - # link against compiler-rt instead of libgcc if this is what clang does - local want_compiler_rt=OFF - if tc-is-clang; then - local compiler_rt=$($(tc-getCC) ${CFLAGS} ${CPPFLAGS} \ - ${LDFLAGS} -print-libgcc-file-name) - if [[ ${compiler_rt} == *libclang_rt* ]]; then - want_compiler_rt=ON - fi - fi + # link to compiler-rt + local use_compiler_rt=OFF + [[ $(tc-get-c-rtlib) == compiler-rt ]] && use_compiler_rt=ON local libdir=$(get_libdir) local mycmakeargs=( @@ -83,7 +77,7 @@ multilib_src_configure() { -DLIBCXXABI_ENABLE_SHARED=ON -DLIBCXXABI_ENABLE_STATIC=$(usex static-libs) -DLIBCXXABI_INCLUDE_TESTS=$(usex test) - -DLIBCXXABI_USE_COMPILER_RT=${want_compiler_rt} + -DLIBCXXABI_USE_COMPILER_RT=${use_compiler_rt} # upstream is omitting standard search path for this # probably because gcc & clang are bundling their own unwind.h diff --git a/sys-libs/libcxxabi/libcxxabi-15.0.3.9999.ebuild b/sys-libs/libcxxabi/libcxxabi-15.0.3.9999.ebuild index 130101c20cb9..8d8f8212d31e 100644 --- a/sys-libs/libcxxabi/libcxxabi-15.0.3.9999.ebuild +++ b/sys-libs/libcxxabi/libcxxabi-15.0.3.9999.ebuild @@ -62,15 +62,9 @@ multilib_src_configure() { strip-unsupported-flags fi - # link against compiler-rt instead of libgcc if this is what clang does - local want_compiler_rt=OFF - if tc-is-clang; then - local compiler_rt=$($(tc-getCC) ${CFLAGS} ${CPPFLAGS} \ - ${LDFLAGS} -print-libgcc-file-name) - if [[ ${compiler_rt} == *libclang_rt* ]]; then - want_compiler_rt=ON - fi - fi + # link to compiler-rt + local use_compiler_rt=OFF + [[ $(tc-get-c-rtlib) == compiler-rt ]] && use_compiler_rt=ON local libdir=$(get_libdir) local mycmakeargs=( @@ -82,7 +76,7 @@ multilib_src_configure() { -DLIBCXXABI_ENABLE_SHARED=ON -DLIBCXXABI_ENABLE_STATIC=$(usex static-libs) -DLIBCXXABI_INCLUDE_TESTS=$(usex test) - -DLIBCXXABI_USE_COMPILER_RT=${want_compiler_rt} + -DLIBCXXABI_USE_COMPILER_RT=${use_compiler_rt} # upstream is omitting standard search path for this # probably because gcc & clang are bundling their own unwind.h diff --git a/sys-libs/libcxxabi/libcxxabi-16.0.0.9999.ebuild b/sys-libs/libcxxabi/libcxxabi-16.0.0.9999.ebuild index 130101c20cb9..8d8f8212d31e 100644 --- a/sys-libs/libcxxabi/libcxxabi-16.0.0.9999.ebuild +++ b/sys-libs/libcxxabi/libcxxabi-16.0.0.9999.ebuild @@ -62,15 +62,9 @@ multilib_src_configure() { strip-unsupported-flags fi - # link against compiler-rt instead of libgcc if this is what clang does - local want_compiler_rt=OFF - if tc-is-clang; then - local compiler_rt=$($(tc-getCC) ${CFLAGS} ${CPPFLAGS} \ - ${LDFLAGS} -print-libgcc-file-name) - if [[ ${compiler_rt} == *libclang_rt* ]]; then - want_compiler_rt=ON - fi - fi + # link to compiler-rt + local use_compiler_rt=OFF + [[ $(tc-get-c-rtlib) == compiler-rt ]] && use_compiler_rt=ON local libdir=$(get_libdir) local mycmakeargs=( @@ -82,7 +76,7 @@ multilib_src_configure() { -DLIBCXXABI_ENABLE_SHARED=ON -DLIBCXXABI_ENABLE_STATIC=$(usex static-libs) -DLIBCXXABI_INCLUDE_TESTS=$(usex test) - -DLIBCXXABI_USE_COMPILER_RT=${want_compiler_rt} + -DLIBCXXABI_USE_COMPILER_RT=${use_compiler_rt} # upstream is omitting standard search path for this # probably because gcc & clang are bundling their own unwind.h diff --git a/sys-libs/libcxxabi/libcxxabi-16.0.0_pre20221006.ebuild b/sys-libs/libcxxabi/libcxxabi-16.0.0_pre20221006.ebuild index 130101c20cb9..8d8f8212d31e 100644 --- a/sys-libs/libcxxabi/libcxxabi-16.0.0_pre20221006.ebuild +++ b/sys-libs/libcxxabi/libcxxabi-16.0.0_pre20221006.ebuild @@ -62,15 +62,9 @@ multilib_src_configure() { strip-unsupported-flags fi - # link against compiler-rt instead of libgcc if this is what clang does - local want_compiler_rt=OFF - if tc-is-clang; then - local compiler_rt=$($(tc-getCC) ${CFLAGS} ${CPPFLAGS} \ - ${LDFLAGS} -print-libgcc-file-name) - if [[ ${compiler_rt} == *libclang_rt* ]]; then - want_compiler_rt=ON - fi - fi + # link to compiler-rt + local use_compiler_rt=OFF + [[ $(tc-get-c-rtlib) == compiler-rt ]] && use_compiler_rt=ON local libdir=$(get_libdir) local mycmakeargs=( @@ -82,7 +76,7 @@ multilib_src_configure() { -DLIBCXXABI_ENABLE_SHARED=ON -DLIBCXXABI_ENABLE_STATIC=$(usex static-libs) -DLIBCXXABI_INCLUDE_TESTS=$(usex test) - -DLIBCXXABI_USE_COMPILER_RT=${want_compiler_rt} + -DLIBCXXABI_USE_COMPILER_RT=${use_compiler_rt} # upstream is omitting standard search path for this # probably because gcc & clang are bundling their own unwind.h diff --git a/sys-libs/libcxxabi/libcxxabi-16.0.0_pre20221010.ebuild b/sys-libs/libcxxabi/libcxxabi-16.0.0_pre20221010.ebuild index 130101c20cb9..8d8f8212d31e 100644 --- a/sys-libs/libcxxabi/libcxxabi-16.0.0_pre20221010.ebuild +++ b/sys-libs/libcxxabi/libcxxabi-16.0.0_pre20221010.ebuild @@ -62,15 +62,9 @@ multilib_src_configure() { strip-unsupported-flags fi - # link against compiler-rt instead of libgcc if this is what clang does - local want_compiler_rt=OFF - if tc-is-clang; then - local compiler_rt=$($(tc-getCC) ${CFLAGS} ${CPPFLAGS} \ - ${LDFLAGS} -print-libgcc-file-name) - if [[ ${compiler_rt} == *libclang_rt* ]]; then - want_compiler_rt=ON - fi - fi + # link to compiler-rt + local use_compiler_rt=OFF + [[ $(tc-get-c-rtlib) == compiler-rt ]] && use_compiler_rt=ON local libdir=$(get_libdir) local mycmakeargs=( @@ -82,7 +76,7 @@ multilib_src_configure() { -DLIBCXXABI_ENABLE_SHARED=ON -DLIBCXXABI_ENABLE_STATIC=$(usex static-libs) -DLIBCXXABI_INCLUDE_TESTS=$(usex test) - -DLIBCXXABI_USE_COMPILER_RT=${want_compiler_rt} + -DLIBCXXABI_USE_COMPILER_RT=${use_compiler_rt} # upstream is omitting standard search path for this # probably because gcc & clang are bundling their own unwind.h diff --git a/sys-libs/llvm-libunwind/llvm-libunwind-13.0.1-r1.ebuild b/sys-libs/llvm-libunwind/llvm-libunwind-13.0.1-r1.ebuild index 1de0765ec1bf..76693df7bef7 100644 --- a/sys-libs/llvm-libunwind/llvm-libunwind-13.0.1-r1.ebuild +++ b/sys-libs/llvm-libunwind/llvm-libunwind-13.0.1-r1.ebuild @@ -38,7 +38,6 @@ pkg_setup() { } multilib_src_configure() { - local use_compiler_rt=OFF local libdir=$(get_libdir) # https://github.com/llvm/llvm-project/issues/56825 @@ -47,13 +46,8 @@ multilib_src_configure() { # link to compiler-rt # https://github.com/gentoo/gentoo/pull/21516 - if tc-is-clang; then - local compiler_rt=$($(tc-getCC) ${CFLAGS} ${CPPFLAGS} \ - ${LD_FLAGS} -print-libgcc-file-name) - if [[ ${compiler_rt} == *libclang_rt* ]]; then - use_compiler_rt=ON - fi - fi + local use_compiler_rt=OFF + [[ $(tc-get-c-rtlib) == compiler-rt ]] && use_compiler_rt=ON local mycmakeargs=( -DLLVM_LIBDIR_SUFFIX=${libdir#lib} diff --git a/sys-libs/llvm-libunwind/llvm-libunwind-14.0.6-r1.ebuild b/sys-libs/llvm-libunwind/llvm-libunwind-14.0.6-r1.ebuild index 3596ed724fe0..336f5fc86bf1 100644 --- a/sys-libs/llvm-libunwind/llvm-libunwind-14.0.6-r1.ebuild +++ b/sys-libs/llvm-libunwind/llvm-libunwind-14.0.6-r1.ebuild @@ -42,7 +42,6 @@ python_check_deps() { } multilib_src_configure() { - local use_compiler_rt=OFF local libdir=$(get_libdir) # https://github.com/llvm/llvm-project/issues/56825 @@ -51,13 +50,8 @@ multilib_src_configure() { # link to compiler-rt # https://github.com/gentoo/gentoo/pull/21516 - if tc-is-clang; then - local compiler_rt=$($(tc-getCC) ${CFLAGS} ${CPPFLAGS} \ - ${LD_FLAGS} -print-libgcc-file-name) - if [[ ${compiler_rt} == *libclang_rt* ]]; then - use_compiler_rt=ON - fi - fi + local use_compiler_rt=OFF + [[ $(tc-get-c-rtlib) == compiler-rt ]] && use_compiler_rt=ON local mycmakeargs=( -DPython3_EXECUTABLE="${PYTHON}" diff --git a/sys-libs/llvm-libunwind/llvm-libunwind-15.0.2.ebuild b/sys-libs/llvm-libunwind/llvm-libunwind-15.0.2.ebuild index cf301e306fd9..d32002debae2 100644 --- a/sys-libs/llvm-libunwind/llvm-libunwind-15.0.2.ebuild +++ b/sys-libs/llvm-libunwind/llvm-libunwind-15.0.2.ebuild @@ -51,7 +51,6 @@ pkg_setup() { } multilib_src_configure() { - local use_compiler_rt=OFF local libdir=$(get_libdir) # https://github.com/llvm/llvm-project/issues/56825 @@ -66,13 +65,8 @@ multilib_src_configure() { # link to compiler-rt # https://github.com/gentoo/gentoo/pull/21516 - if tc-is-clang; then - local compiler_rt=$($(tc-getCC) ${CFLAGS} ${CPPFLAGS} \ - ${LD_FLAGS} -print-libgcc-file-name) - if [[ ${compiler_rt} == *libclang_rt* ]]; then - use_compiler_rt=ON - fi - fi + local use_compiler_rt=OFF + [[ $(tc-get-c-rtlib) == compiler-rt ]] && use_compiler_rt=ON local mycmakeargs=( -DCMAKE_CXX_COMPILER_TARGET="${CHOST}" diff --git a/sys-libs/llvm-libunwind/llvm-libunwind-15.0.3.9999.ebuild b/sys-libs/llvm-libunwind/llvm-libunwind-15.0.3.9999.ebuild index b53a48502232..2f98df4d5ed6 100644 --- a/sys-libs/llvm-libunwind/llvm-libunwind-15.0.3.9999.ebuild +++ b/sys-libs/llvm-libunwind/llvm-libunwind-15.0.3.9999.ebuild @@ -50,7 +50,6 @@ pkg_setup() { } multilib_src_configure() { - local use_compiler_rt=OFF local libdir=$(get_libdir) # https://github.com/llvm/llvm-project/issues/56825 @@ -65,13 +64,8 @@ multilib_src_configure() { # link to compiler-rt # https://github.com/gentoo/gentoo/pull/21516 - if tc-is-clang; then - local compiler_rt=$($(tc-getCC) ${CFLAGS} ${CPPFLAGS} \ - ${LD_FLAGS} -print-libgcc-file-name) - if [[ ${compiler_rt} == *libclang_rt* ]]; then - use_compiler_rt=ON - fi - fi + local use_compiler_rt=OFF + [[ $(tc-get-c-rtlib) == compiler-rt ]] && use_compiler_rt=ON local mycmakeargs=( -DCMAKE_CXX_COMPILER_TARGET="${CHOST}" diff --git a/sys-libs/llvm-libunwind/llvm-libunwind-16.0.0.9999.ebuild b/sys-libs/llvm-libunwind/llvm-libunwind-16.0.0.9999.ebuild index b53a48502232..2f98df4d5ed6 100644 --- a/sys-libs/llvm-libunwind/llvm-libunwind-16.0.0.9999.ebuild +++ b/sys-libs/llvm-libunwind/llvm-libunwind-16.0.0.9999.ebuild @@ -50,7 +50,6 @@ pkg_setup() { } multilib_src_configure() { - local use_compiler_rt=OFF local libdir=$(get_libdir) # https://github.com/llvm/llvm-project/issues/56825 @@ -65,13 +64,8 @@ multilib_src_configure() { # link to compiler-rt # https://github.com/gentoo/gentoo/pull/21516 - if tc-is-clang; then - local compiler_rt=$($(tc-getCC) ${CFLAGS} ${CPPFLAGS} \ - ${LD_FLAGS} -print-libgcc-file-name) - if [[ ${compiler_rt} == *libclang_rt* ]]; then - use_compiler_rt=ON - fi - fi + local use_compiler_rt=OFF + [[ $(tc-get-c-rtlib) == compiler-rt ]] && use_compiler_rt=ON local mycmakeargs=( -DCMAKE_CXX_COMPILER_TARGET="${CHOST}" diff --git a/sys-libs/llvm-libunwind/llvm-libunwind-16.0.0_pre20221006.ebuild b/sys-libs/llvm-libunwind/llvm-libunwind-16.0.0_pre20221006.ebuild index 1d7329494c4c..7128dcaa091f 100644 --- a/sys-libs/llvm-libunwind/llvm-libunwind-16.0.0_pre20221006.ebuild +++ b/sys-libs/llvm-libunwind/llvm-libunwind-16.0.0_pre20221006.ebuild @@ -50,7 +50,6 @@ pkg_setup() { } multilib_src_configure() { - local use_compiler_rt=OFF local libdir=$(get_libdir) # https://github.com/llvm/llvm-project/issues/56825 @@ -65,13 +64,8 @@ multilib_src_configure() { # link to compiler-rt # https://github.com/gentoo/gentoo/pull/21516 - if tc-is-clang; then - local compiler_rt=$($(tc-getCC) ${CFLAGS} ${CPPFLAGS} \ - ${LD_FLAGS} -print-libgcc-file-name) - if [[ ${compiler_rt} == *libclang_rt* ]]; then - use_compiler_rt=ON - fi - fi + local use_compiler_rt=OFF + [[ $(tc-get-c-rtlib) == compiler-rt ]] && use_compiler_rt=ON local mycmakeargs=( -DCMAKE_CXX_COMPILER_TARGET="${CHOST}" diff --git a/sys-libs/llvm-libunwind/llvm-libunwind-16.0.0_pre20221010.ebuild b/sys-libs/llvm-libunwind/llvm-libunwind-16.0.0_pre20221010.ebuild index 1d7329494c4c..cb718502b12b 100644 --- a/sys-libs/llvm-libunwind/llvm-libunwind-16.0.0_pre20221010.ebuild +++ b/sys-libs/llvm-libunwind/llvm-libunwind-16.0.0_pre20221010.ebuild @@ -50,7 +50,6 @@ pkg_setup() { } multilib_src_configure() { - local use_compiler_rt=OFF local libdir=$(get_libdir) # https://github.com/llvm/llvm-project/issues/56825 @@ -65,13 +64,8 @@ multilib_src_configure() { # link to compiler-rt # https://github.com/gentoo/gentoo/pull/21516 - if tc-is-clang; then - local compiler_rt=$($(tc-getCC) ${CFLAGS} ${CPPFLAGS} \ - ${LD_FLAGS} -print-libgcc-file-name) - if [[ ${compiler_rt} == *libclang_rt* ]]; then - use_compiler_rt=ON - fi - fi + local use_compiler_rt=OFF + [[ $(tc-get-c-rtlib) == compiler-rt ]] && use_compiler_rt=ON local mycmakeargs=( -DCMAKE_CXX_COMPILER_TARGET="${CHOST}" @@ -80,13 +74,11 @@ multilib_src_configure() { -DLLVM_LIBDIR_SUFFIX=${libdir#lib} -DLLVM_INCLUDE_TESTS=OFF -DLIBUNWIND_ENABLE_ASSERTIONS=$(usex debug) + -DLIBUNWIND_ENABLE_CROSS_UNWINDING=ON -DLIBUNWIND_ENABLE_STATIC=$(usex static-libs) -DLIBUNWIND_INCLUDE_TESTS=$(usex test) -DLIBUNWIND_INSTALL_HEADERS=ON - # temporarily disabled due to upstream regression - -DLIBUNWIND_ENABLE_CROSS_UNWINDING=OFF - # avoid dependency on libgcc_s if compiler-rt is used -DLIBUNWIND_USE_COMPILER_RT=${use_compiler_rt} ) |