From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 0E3BC15812D for ; Mon, 30 Dec 2024 11:35:08 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id ED093E081A; Mon, 30 Dec 2024 11:35:06 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id D2CD0E0823 for ; Mon, 30 Dec 2024 11:35:06 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 1845633BF39 for ; Mon, 30 Dec 2024 11:35:06 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 1DBAB190D for ; Mon, 30 Dec 2024 11:35:04 +0000 (UTC) From: "Michał Górny" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" Message-ID: <1735558349.93056be235ad8804d3865005737ed6b54ac9aad3.mgorny@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/ X-VCS-Repository: repo/gentoo X-VCS-Files: eclass/llvm-r2.eclass X-VCS-Directories: eclass/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: 93056be235ad8804d3865005737ed6b54ac9aad3 X-VCS-Branch: master Date: Mon, 30 Dec 2024 11:35:04 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: ead40eb3-6c5c-4274-a635-659ab5d2f0e5 X-Archives-Hash: 88c08ed5b9247798498aa6c94117eb67 commit: 93056be235ad8804d3865005737ed6b54ac9aad3 Author: Michał Górny gentoo org> AuthorDate: Mon Dec 16 10:17:59 2024 +0000 Commit: Michał Górny gentoo org> CommitDate: Mon Dec 30 11:32:29 2024 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=93056be2 llvm-r2.eclass: Readjust for BROOT, split to llvm_cbuild_setup Readjust the old pkg_setup logic for BROOT tool use, move it to llvm_cbuild_setup function. Signed-off-by: Michał Górny gentoo.org> eclass/llvm-r2.eclass | 45 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 11 deletions(-) diff --git a/eclass/llvm-r2.eclass b/eclass/llvm-r2.eclass index 6d0223f73f10..93c16e75be83 100644 --- a/eclass/llvm-r2.eclass +++ b/eclass/llvm-r2.eclass @@ -216,6 +216,38 @@ get_llvm_prefix() { echo "${prefix}/usr/lib/llvm/${LLVM_SLOT}" } +# @FUNCTION: llvm_cbuild_setup +# @DESCRIPTION: +# Prepend the PATH for selected LLVM version in CBUILD. +# +# This function is meant to be used when the package in question uses +# LLVM tools at build time. It is called automatically +# by llvm-r2_pkg_setup if LLVM is found installed in BROOT. +# +# Note that llvm-config from this path must not be used to build against +# LLVM, as that will break cross-compilation. +llvm_cbuild_setup() { + debug-print-function ${FUNCNAME} "$@" + + local broot_prefix=$(get_llvm_prefix -b) + einfo "Using ${broot_prefix} for CBUILD LLVM ${LLVM_SLOT}" + [[ -d ${broot_prefix}/bin ]] || + die "LLVM ${LLVM_SLOT} not found installed in BROOT (expected: ${broot_prefix}/bin)" + + llvm_fix_clang_version CC CPP CXX + # keep in sync with profiles/features/llvm/make.defaults! + llvm_fix_tool_path ADDR2LINE AR AS LD NM OBJCOPY OBJDUMP RANLIB + llvm_fix_tool_path READELF STRINGS STRIP + + # Set LLVM_CONFIG to help Meson (bug #907965) but only do it + # for empty ESYSROOT (as a proxy for "are we cross-compiling?"). + if [[ -z ${ESYSROOT} ]] ; then + llvm_fix_tool_path LLVM_CONFIG + fi + + llvm_prepend_path -b "${LLVM_SLOT}" +} + # @FUNCTION: llvm-r2_pkg_setup # @DESCRIPTION: # Prepend the appropriate executable directory for the selected LLVM @@ -235,18 +267,9 @@ llvm-r2_pkg_setup() { if [[ ${MERGE_TYPE} != binary ]]; then [[ -z ${LLVM_SLOT} ]] && die "LLVM_SLOT unset (broken USE_EXPAND?)" - llvm_fix_clang_version CC CPP CXX - # keep in sync with profiles/features/llvm/make.defaults! - llvm_fix_tool_path ADDR2LINE AR AS LD NM OBJCOPY OBJDUMP RANLIB - llvm_fix_tool_path READELF STRINGS STRIP - - # Set LLVM_CONFIG to help Meson (bug #907965) but only do it - # for empty ESYSROOT (as a proxy for "are we cross-compiling?"). - if [[ -z ${ESYSROOT} ]] ; then - llvm_fix_tool_path LLVM_CONFIG + if [[ -d $(get_llvm_prefix -b)/bin ]]; then + llvm_cbuild_setup fi - - llvm_prepend_path "${LLVM_SLOT}" fi }