commit:     90865237269a77e27ea75f8179b5e5fc0ea99f7c
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Dec  7 19:25:30 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Dec  7 19:25:57 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=90865237

sys-libs/llvm-offload: Let users enable GPU testing

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 sys-libs/llvm-offload/llvm-offload-20.0.0.9999.ebuild        | 10 ++++++++++
 sys-libs/llvm-offload/llvm-offload-20.0.0_pre20241207.ebuild | 10 ++++++++++
 2 files changed, 20 insertions(+)

diff --git a/sys-libs/llvm-offload/llvm-offload-20.0.0.9999.ebuild 
b/sys-libs/llvm-offload/llvm-offload-20.0.0.9999.ebuild
index e47a34dbbcac..1e9ec4ce3ce4 100644
--- a/sys-libs/llvm-offload/llvm-offload-20.0.0.9999.ebuild
+++ b/sys-libs/llvm-offload/llvm-offload-20.0.0.9999.ebuild
@@ -48,6 +48,14 @@ LLVM_COMPONENTS=( offload cmake runtimes/cmake libc/shared )
 LLVM_TEST_COMPONENTS=( openmp/cmake )
 llvm.org_set_globals
 
+pkg_pretend() {
+       if [[ ${LLVM_ALLOW_GPU_TESTING} ]]; then
+               ewarn "LLVM_ALLOW_GPU_TESTING set.  This package will run tests 
against your"
+               ewarn "GPU if it is supported.  Note that these tests may be 
flaky, fail or"
+               ewarn "hang, or even cause your GPU to crash (requiring a 
reboot)."
+       fi
+}
+
 pkg_setup() {
        if use test; then
                python-any-r1_pkg_setup
@@ -95,7 +103,9 @@ src_configure() {
 
                -DFFI_INCLUDE_DIR="${ffi_cflags#-I}"
                -DFFI_LIBRARY_DIR="${ffi_ldflags#-L}"
+       )
 
+       [[ ! ${LLVM_ALLOW_GPU_TESTING} ]] && mycmakeargs+=(
                # prevent trying to access the GPU
                -DLIBOMPTARGET_AMDGPU_ARCH=LIBOMPTARGET_AMDGPU_ARCH-NOTFOUND
                -DLIBOMPTARGET_NVPTX_ARCH=LIBOMPTARGET_NVPTX_ARCH-NOTFOUND

diff --git a/sys-libs/llvm-offload/llvm-offload-20.0.0_pre20241207.ebuild 
b/sys-libs/llvm-offload/llvm-offload-20.0.0_pre20241207.ebuild
index e86522254aa8..adee1702c49a 100644
--- a/sys-libs/llvm-offload/llvm-offload-20.0.0_pre20241207.ebuild
+++ b/sys-libs/llvm-offload/llvm-offload-20.0.0_pre20241207.ebuild
@@ -49,6 +49,14 @@ LLVM_COMPONENTS=( offload cmake runtimes/cmake libc/shared )
 LLVM_TEST_COMPONENTS=( openmp/cmake )
 llvm.org_set_globals
 
+pkg_pretend() {
+       if [[ ${LLVM_ALLOW_GPU_TESTING} ]]; then
+               ewarn "LLVM_ALLOW_GPU_TESTING set.  This package will run tests 
against your"
+               ewarn "GPU if it is supported.  Note that these tests may be 
flaky, fail or"
+               ewarn "hang, or even cause your GPU to crash (requiring a 
reboot)."
+       fi
+}
+
 pkg_setup() {
        if use test; then
                python-any-r1_pkg_setup
@@ -100,7 +108,9 @@ src_configure() {
 
                -DFFI_INCLUDE_DIR="${ffi_cflags#-I}"
                -DFFI_LIBRARY_DIR="${ffi_ldflags#-L}"
+       )
 
+       [[ ! ${LLVM_ALLOW_GPU_TESTING} ]] && mycmakeargs+=(
                # prevent trying to access the GPU
                -DLIBOMPTARGET_AMDGPU_ARCH=LIBOMPTARGET_AMDGPU_ARCH-NOTFOUND
                -DLIBOMPTARGET_NVPTX_ARCH=LIBOMPTARGET_NVPTX_ARCH-NOTFOUND

Reply via email to