commit:     135bd0f4429ba1508b7bbf47ffabfc6f3de238ee
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 28 13:16:23 2017 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Sep 28 13:16:23 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=135bd0f4

media-libs/mesa: Backport LLVM dep fixes to 17.2.1

 media-libs/mesa/mesa-17.2.1.ebuild | 103 ++++++++++++++++++++++++++++++++-----
 1 file changed, 89 insertions(+), 14 deletions(-)

diff --git a/media-libs/mesa/mesa-17.2.1.ebuild 
b/media-libs/mesa/mesa-17.2.1.ebuild
index f54779f9572..2b6f32728db 100644
--- a/media-libs/mesa/mesa-17.2.1.ebuild
+++ b/media-libs/mesa/mesa-17.2.1.ebuild
@@ -97,7 +97,6 @@ RDEPEND="
        llvm? (
                video_cards_radeonsi? (
                        virtual/libelf:0=[${MULTILIB_USEDEP}]
-                       vulkan? ( >=sys-devel/llvm-3.9.0:=[${MULTILIB_USEDEP}] )
                )
                video_cards_r600? (
                        virtual/libelf:0=[${MULTILIB_USEDEP}]
@@ -105,7 +104,6 @@ RDEPEND="
                video_cards_radeon? (
                        virtual/libelf:0=[${MULTILIB_USEDEP}]
                )
-               >=sys-devel/llvm-3.6.0:=[${MULTILIB_USEDEP}]
        )
        opencl? (
                                app-eselect/eselect-opencl
@@ -139,20 +137,84 @@ RDEPEND="${RDEPEND}
        video_cards_radeonsi? ( ${LIBDRM_DEPSTRING}[video_cards_amdgpu] )
 "
 
-# FIXME: kill the sys-devel/llvm[video_cards_radeon] compat once
-# LLVM < 3.9 is out of the game
-DEPEND="${RDEPEND}
-       ${PYTHON_DEPS}
+# Please keep the LLVM dependency block separate. Since LLVM is slotted,
+# we need to *really* make sure we're not pulling one than more slot
+# 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. < 7.
+# 3. Specify LLVM_MAX_SLOT, e.g. 6.
+LLVM_DEPSTR="
+       || (
+               sys-devel/llvm:6[${MULTILIB_USEDEP}]
+               sys-devel/llvm:5[${MULTILIB_USEDEP}]
+               sys-devel/llvm:4[${MULTILIB_USEDEP}]
+               >=sys-devel/llvm-3.9.0:0[${MULTILIB_USEDEP}]
+       )
+       sys-devel/llvm:=[${MULTILIB_USEDEP}]
+"
+LLVM_DEPSTR_AMDGPU=${LLVM_DEPSTR//]/,llvm_targets_AMDGPU(-)]}
+CLANG_DEPSTR=${LLVM_DEPSTR//llvm/clang}
+CLANG_DEPSTR_AMDGPU=${CLANG_DEPSTR//]/,llvm_targets_AMDGPU(-)]}
+RDEPEND="${RDEPEND}
        llvm? (
-               video_cards_radeonsi? ( || (
-                       sys-devel/llvm[llvm_targets_AMDGPU]
-                       sys-devel/llvm[video_cards_radeon]
-               ) )
+               opencl? (
+                       video_cards_r600? (
+                               ${CLANG_DEPSTR_AMDGPU}
+                       )
+                       !video_cards_r600? (
+                               video_cards_radeonsi? (
+                                       ${CLANG_DEPSTR_AMDGPU}
+                               )
+                       )
+                       !video_cards_r600? (
+                               !video_cards_radeonsi? (
+                                       video_cards_radeon? (
+                                               ${CLANG_DEPSTR_AMDGPU}
+                                       )
+                               )
+                       )
+                       !video_cards_r600? (
+                               !video_cards_radeon? (
+                                       !video_cards_radeonsi? (
+                                               ${CLANG_DEPSTR}
+                                       )
+                               )
+                       )
+               )
+               !opencl? (
+                       video_cards_r600? (
+                               ${LLVM_DEPSTR_AMDGPU}
+                       )
+                       !video_cards_r600? (
+                               video_cards_radeonsi? (
+                                       ${LLVM_DEPSTR_AMDGPU}
+                               )
+                       )
+                       !video_cards_r600? (
+                               !video_cards_radeonsi? (
+                                       video_cards_radeon? (
+                                               ${LLVM_DEPSTR_AMDGPU}
+                                       )
+                               )
+                       )
+                       !video_cards_r600? (
+                               !video_cards_radeon? (
+                                       !video_cards_radeonsi? (
+                                               ${LLVM_DEPSTR}
+                                       )
+                               )
+                       )
+               )
        )
+"
+unset {LLVM,CLANG}_DEPSTR{,_AMDGPU}
+
+DEPEND="${RDEPEND}
+       ${PYTHON_DEPS}
        opencl? (
-                               >=sys-devel/llvm-3.6.0:=[${MULTILIB_USEDEP}]
-                               >=sys-devel/clang-3.6.0:=[${MULTILIB_USEDEP}]
-                               >=sys-devel/gcc-4.6
+               >=sys-devel/gcc-4.6
        )
        sys-devel/gettext
        virtual/pkgconfig
@@ -187,6 +249,19 @@ x86? (
        )
 )"
 
+llvm_check_deps() {
+       local flags=${MULTILIB_USEDEP}
+       if use video_cards_r600 || use video_cards_radeon || use 
video_cards_radeonsi
+       then
+               flags+=",llvm_targets_AMDGPU(-)"
+       fi
+
+       if use opencl; then
+               has_version "sys-devel/clang[${flags}]" || return 1
+       fi
+       has_version "sys-devel/llvm[${flags}]"
+}
+
 pkg_setup() {
        # warning message for bug 459306
        if use llvm && has_version sys-devel/llvm[!debug=]; then
@@ -194,7 +269,7 @@ pkg_setup() {
                ewarn "detected! This can cause problems. For details, see bug 
459306."
        fi
 
-       if use llvm || use opencl; then
+       if use llvm; then
                llvm_pkg_setup
        fi
        python-any-r1_pkg_setup

Reply via email to