commit:     885a91ff28725c3f7d3c8a1b198e03340668b252
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 19 08:27:57 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jul 19 11:35:10 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=885a91ff

llvm.org.eclass: extend LLVM_USE_TARGETS

Add an additional 'llvm+eq' value which works the same as LLVM_USE_TARGETS=llvm,
but with matching use= deps on LLVM_TARGETS. Needed for packages
which automagically use available targets via e.g. LLVM's InitializeAllTargets.

This sets us on a path to dropping the package.use.force entries
for LLVM_TARGETS.

Bug: https://bugs.gentoo.org/767700
Bug: https://bugs.gentoo.org/768267
Signed-off-by: Sam James <sam <AT> gentoo.org>

 eclass/llvm.org.eclass | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/eclass/llvm.org.eclass b/eclass/llvm.org.eclass
index eaec1b8a3a5f..0fec50a95e2b 100644
--- a/eclass/llvm.org.eclass
+++ b/eclass/llvm.org.eclass
@@ -140,6 +140,10 @@ fi
 #   on matching llvm-core/llvm versions with requested flags will
 #   be added.
 #
+# - llvm+eq - this package automagically uses targets from LLVM by using
+#   a function like InitializeAllTargets.  Same behavior as =llvm, but
+#   with matching use= deps for targets.
+#
 # Note that you still need to pass enabled targets to the build system,
 # usually grabbing them from ${LLVM_TARGETS} (via USE_EXPAND).
 
@@ -334,7 +338,7 @@ llvm.org_set_globals() {
        case ${LLVM_USE_TARGETS:-__unset__} in
                __unset__)
                        ;;
-               provide|llvm)
+               provide|llvm|llvm+eq)
                        IUSE+=" ${ALL_LLVM_TARGET_FLAGS[*]}"
                        REQUIRED_USE+=" || ( ${ALL_LLVM_TARGET_FLAGS[*]} )"
                        ;;&
@@ -347,6 +351,15 @@ llvm.org_set_globals() {
                        RDEPEND+=" ${dep}"
                        DEPEND+=" ${dep}"
                        ;;
+               llvm+eq)
+                       local dep=
+                       for x in "${ALL_LLVM_TARGET_FLAGS[@]}"; do
+                               dep+="
+                                       ${x}? ( ~llvm-core/llvm-${PV}[${x}=] )"
+                       done
+                       RDEPEND+=" ${dep}"
+                       DEPEND+=" ${dep}"
+                       ;;
        esac
 
        # === useful defaults for cmake-based packages ===

Reply via email to