summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'dev-lang/rust')
-rw-r--r--dev-lang/rust/rust-1.62.1.ebuild24
-rw-r--r--dev-lang/rust/rust-1.63.0-r1.ebuild24
2 files changed, 28 insertions, 20 deletions
diff --git a/dev-lang/rust/rust-1.62.1.ebuild b/dev-lang/rust/rust-1.62.1.ebuild
index 14499d27ee4f..330a83219754 100644
--- a/dev-lang/rust/rust-1.62.1.ebuild
+++ b/dev-lang/rust/rust-1.62.1.ebuild
@@ -222,6 +222,17 @@ llvm_check_deps() {
has_version -r "sys-devel/llvm:${LLVM_SLOT}[${LLVM_TARGET_USEDEPS// /,}]"
}
+# 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* ]]
+}
+
pkg_pretend() {
pre_build_checks
}
@@ -258,7 +269,7 @@ src_prepare() {
src_configure() {
filter-flags '-flto*' # https://bugs.gentoo.org/862109
- local rust_target="" rust_targets="" arch_cflags use_libcxx="false"
+ local rust_target="" rust_targets="" arch_cflags
# Collect rust target names to compile standard libs for all ABIs.
for v in $(multilib_get_enabled_abi_pairs); do
@@ -307,14 +318,6 @@ src_configure() {
rust_target="$(rust_abi)"
- # https://bugs.gentoo.org/732632
- if tc-is-clang; then
- local clang_slot="$(clang-major-version)"
- if { has_version "sys-devel/clang:${clang_slot}[default-libcxx(-)]" || has_version "=sys-devel/clang-common-${clang_slot}*[default-libcxx(-)]" || is-flagq -stdlib=libc++; }; then
- use_libcxx="true"
- fi
- fi
-
local cm_btype="$(usex debug DEBUG RELEASE)"
cat <<- _EOF_ > "${S}"/config.toml
changelog-seen = 2
@@ -327,7 +330,8 @@ src_configure() {
targets = "${LLVM_TARGETS// /;}"
experimental-targets = ""
link-shared = $(toml_usex system-llvm)
- $(if [[ ${use_libcxx} == true ]]; then
+ $(if is_libcxx_linked; then
+ # https://bugs.gentoo.org/732632
echo "use-libcxx = true"
echo "static-libstdcpp = false"
fi)
diff --git a/dev-lang/rust/rust-1.63.0-r1.ebuild b/dev-lang/rust/rust-1.63.0-r1.ebuild
index 0e8a344f1bd1..d0595ed73590 100644
--- a/dev-lang/rust/rust-1.63.0-r1.ebuild
+++ b/dev-lang/rust/rust-1.63.0-r1.ebuild
@@ -232,6 +232,17 @@ llvm_check_deps() {
has_version -r "sys-devel/llvm:${LLVM_SLOT}[${LLVM_TARGET_USEDEPS// /,}]"
}
+# 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* ]]
+}
+
pkg_pretend() {
pre_build_checks
}
@@ -288,7 +299,7 @@ src_prepare() {
src_configure() {
filter-flags '-flto*' # https://bugs.gentoo.org/862109
- local rust_target="" rust_targets="" arch_cflags use_libcxx="false"
+ local rust_target="" rust_targets="" arch_cflags
# Collect rust target names to compile standard libs for all ABIs.
for v in $(multilib_get_enabled_abi_pairs); do
@@ -337,14 +348,6 @@ src_configure() {
rust_target="$(rust_abi)"
- # https://bugs.gentoo.org/732632
- if tc-is-clang; then
- local clang_slot="$(clang-major-version)"
- if { has_version "sys-devel/clang:${clang_slot}[default-libcxx(-)]" || has_version "=sys-devel/clang-common-${clang_slot}*[default-libcxx(-)]" || is-flagq -stdlib=libc++; }; then
- use_libcxx="true"
- fi
- fi
-
local cm_btype="$(usex debug DEBUG RELEASE)"
cat <<- _EOF_ > "${S}"/config.toml
changelog-seen = 2
@@ -357,7 +360,8 @@ src_configure() {
targets = "${LLVM_TARGETS// /;}"
experimental-targets = ""
link-shared = $(toml_usex system-llvm)
- $(if [[ ${use_libcxx} == true ]]; then
+ $(if is_libcxx_linked; then
+ # https://bugs.gentoo.org/732632
echo "use-libcxx = true"
echo "static-libstdcpp = false"
fi)