From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: "Michał Górny" <mgorny@gentoo.org>
Subject: [gentoo-dev] [PATCH 05/11] llvm-r2.eclass: Readjust for BROOT, split to llvm_cbuild_setup
Date: Sat, 21 Dec 2024 16:48:38 +0100 [thread overview]
Message-ID: <20241221160053.780079-6-mgorny@gentoo.org> (raw)
In-Reply-To: <20241221160053.780079-1-mgorny@gentoo.org>
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 ]] ||
+ 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
}
--
2.47.1
next prev parent reply other threads:[~2024-12-21 16:02 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-21 15:48 [gentoo-dev] [PATCH 00/11] llvm-r2.eclass, to unmess pkg_setup and fix cross Michał Górny
2024-12-21 15:48 ` [gentoo-dev] [PATCH 01/11] llvm-r1.eclass: Fix list in eclassdoc Michał Górny
2024-12-21 15:48 ` [gentoo-dev] [PATCH 02/11] llvm-r2.eclass: Copy from llvm-r1.eclass Michał Górny
2024-12-21 15:48 ` [gentoo-dev] [PATCH 03/11] HACK! llvm-r1 -> llvm-r2 (to ease testing) Michał Górny
2024-12-21 15:48 ` [gentoo-dev] [PATCH 04/11] llvm-utils.eclass: Support -b/-d to llvm_prepend_path Michał Górny
2024-12-21 15:48 ` Michał Górny [this message]
2024-12-21 15:48 ` [gentoo-dev] [PATCH 06/11] llvm-r2.eclass: Add llvm_chost_setup, set CMake path variables Michał Górny
2024-12-21 15:48 ` [gentoo-dev] [PATCH 07/11] llvm-r2.eclass: Generate a llvm-config script for CHOST Michał Górny
2024-12-21 15:48 ` [gentoo-dev] [PATCH 08/11] llvm-r2.eclass: Update top-level docs for CBUILD/CHOST support Michał Górny
2024-12-21 15:48 ` [gentoo-dev] [PATCH 09/11] llvm-r2.eclass: Remove obsolete Meson LLVM_CONFIG hack Michał Górny
2024-12-21 15:48 ` [gentoo-dev] [PATCH 10/11] eclass/tests: Copy llvm-r1 tests to llvm-r2.sh Michał Górny
2024-12-21 15:48 ` [gentoo-dev] [PATCH 11/11] eclass/tests/llvm-r2.sh: Add tests for llvm-config Michał Górny
2024-12-30 11:35 ` [gentoo-dev] [PATCH 00/11] llvm-r2.eclass, to unmess pkg_setup and fix cross Michał Górny
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241221160053.780079-6-mgorny@gentoo.org \
--to=mgorny@gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox