commit:     ae0c05cb715af91b4f1ffbc406c1c766ed866e92
Author:     orbea <orbea <AT> riseup <DOT> net>
AuthorDate: Tue Nov 15 02:25:04 2022 +0000
Commit:     Quentin Retornaz <gentoo <AT> retornaz <DOT> com>
CommitDate: Tue Nov 15 21:17:46 2022 +0000
URL:        https://gitweb.gentoo.org/repo/proj/libressl.git/commit/?id=ae0c05cb

dev-lang/rust: Merge ::gentoo changes

Signed-off-by: orbea <orbea <AT> riseup.net>
Signed-off-by: Quentin Retornaz <gentoo <AT> retornaz.com>

 dev-lang/rust/rust-1.64.0-r1.ebuild | 38 +++++++++++++++++--------------------
 1 file changed, 17 insertions(+), 21 deletions(-)

diff --git a/dev-lang/rust/rust-1.64.0-r1.ebuild 
b/dev-lang/rust/rust-1.64.0-r1.ebuild
index 71eb093..1d11fd7 100644
--- a/dev-lang/rust/rust-1.64.0-r1.ebuild
+++ b/dev-lang/rust/rust-1.64.0-r1.ebuild
@@ -19,7 +19,7 @@ else
        SLOT="stable/${ABI_VER}"
        MY_P="rustc-${PV}"
        SRC="${MY_P}-src.tar.xz"
-       KEYWORDS="~amd64 ~arm ~arm64 ~mips ~ppc64 ~riscv ~sparc ~x86"
+       KEYWORDS="amd64 arm arm64 ~mips ppc64 sparc x86"
 fi
 
 RUST_STAGE0_VERSION="1.$(($(ver_cut 2) - 1)).0"
@@ -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
 }
@@ -305,7 +316,7 @@ src_prepare() {
 src_configure() {
        filter-flags '-flto*' # https://bugs.gentoo.org/862109 
https://bugs.gentoo.org/866231
 
-       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
@@ -343,14 +354,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]" || 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
@@ -363,7 +366,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)
@@ -626,12 +630,8 @@ src_test() {
        for i in "${tests[@]}"; do
                local t="src/test/${i}"
                einfo "rust_src_test: running ${t}"
-               if ! (
-                               IFS=$'\n'
-                               env $(cat "${S}"/config.env) RUST_BACKTRACE=1 \
-                               "${EPYTHON}" ./x.py test -vv 
--config="${S}"/config.toml \
+               if ! RUST_BACKTRACE=1 "${EPYTHON}" ./x.py test -vv 
--config="${S}"/config.toml \
                                -j$(makeopts_jobs) --no-doc --no-fail-fast 
"${t}"
-                       )
                then
                                failed+=( "${t}" )
                                eerror "rust_src_test: ${t} failed"
@@ -645,11 +645,7 @@ src_test() {
 }
 
 src_install() {
-       (
-       IFS=$'\n'
-       env $(cat "${S}"/config.env) DESTDIR="${D}" \
-               "${EPYTHON}" ./x.py install     -vv --config="${S}"/config.toml 
-j$(makeopts_jobs) || die
-       )
+       DESTDIR="${D}" "${EPYTHON}" ./x.py install -vv 
--config="${S}"/config.toml -j$(makeopts_jobs) || die
 
        # bug #689562, #689160
        rm -v "${ED}/usr/lib/${PN}/${PV}/etc/bash_completion.d/cargo" || die

Reply via email to