• [gentoo-dev] [PATCH 05/11] llvm-r2.eclass: Readjust for BROOT, split to

    From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Sat Dec 21 17:10:02 2024
    Readjust the old pkg_setup logic for BROOT tool use, move it to llvm_cbuild_setup function.

    Signed-off-by: Michał Górny <mgorny@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 ]] ||