commit:     e509d02ff6ca4d4bd36bd601201f47ae1405dec4
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Fri May 12 02:40:41 2023 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Fri May 12 17:18:42 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e509d02f

media-libs/mesa: Generate LLVM_DEPSTR

This reduces a lot of copy-and-paste, which will help when other
dependencies that are tied to the llvm major version are added here.

Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 media-libs/mesa/mesa-9999.ebuild | 31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/media-libs/mesa/mesa-9999.ebuild b/media-libs/mesa/mesa-9999.ebuild
index e5976cb09708..dba9e680f61f 100644
--- a/media-libs/mesa/mesa-9999.ebuild
+++ b/media-libs/mesa/mesa-9999.ebuild
@@ -103,29 +103,30 @@ RDEPEND="${RDEPEND}
 # simultaneously.
 #
 # How to use it:
-# 1. List all the working slots (with min versions) in ||, newest first.
-# 2. Update the := to specify *max* version, e.g. < 10.
-# 3. Specify LLVM_MAX_SLOT, e.g. 9.
+# 1. Specify LLVM_MAX_SLOT (inclusive), e.g. 16.
+# 2. Specify LLVM_MIN_SLOT (inclusive), e.g. 15.
 LLVM_MAX_SLOT="16"
+LLVM_MIN_SLOT="15"
 LLVM_USE_DEPS="llvm_targets_AMDGPU(+),${MULTILIB_USEDEP}"
+PER_SLOT_DEPSTR="
+       (
+               !opencl? ( sys-devel/llvm:@SLOT@[${LLVM_USE_DEPS}] )
+               opencl? ( sys-devel/clang:@SLOT@[${LLVM_USE_DEPS}] )
+       )
+"
 LLVM_DEPSTR="
        || (
-               sys-devel/@@@@:16[${LLVM_USE_DEPS}]
-               sys-devel/@@@@:15[${LLVM_USE_DEPS}]
+               $(for ((slot=LLVM_MAX_SLOT; slot>=LLVM_MIN_SLOT; slot--)); do
+                       echo "${PER_SLOT_DEPSTR//@SLOT@/${slot}}"
+               done)
        )
-       <sys-devel/@@@@-$((LLVM_MAX_SLOT + 1)):=[${LLVM_USE_DEPS}]
+       !opencl? ( <sys-devel/llvm-$((LLVM_MAX_SLOT + 1)):=[${LLVM_USE_DEPS}] )
+       opencl? ( <sys-devel/clang-$((LLVM_MAX_SLOT + 1)):=[${LLVM_USE_DEPS}] )
 "
 RDEPEND="${RDEPEND}
-       llvm? (
-               opencl? (
-                       ${LLVM_DEPSTR//@@@@/clang}
-               )
-               !opencl? (
-                       ${LLVM_DEPSTR//@@@@/llvm}
-               )
-       )
+       llvm? ( ${LLVM_DEPSTR} )
 "
-unset LLVM_DEPSTR
+unset LLVM_MIN_SLOT {LLVM,PER_SLOT}_DEPSTR
 
 DEPEND="${RDEPEND}
        video_cards_d3d12? ( dev-util/directx-headers[${MULTILIB_USEDEP}] )

Reply via email to