commit:     0d2183020388388d2592ae3a879164985125b81c
Author:     Sv. Lockal <lockalsash <AT> gmail <DOT> com>
AuthorDate: Sun Aug 10 13:26:09 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Sep  6 15:12:54 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0d218302

sci-libs/rocThrust: fix compilation with benchmark, update depends

Closes: https://bugs.gentoo.org/960483

Signed-off-by: Sv. Lockal <lockalsash <AT> gmail.com>
Part-of: https://github.com/gentoo/gentoo/pull/43406
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/rocThrust-6.4.3-gbenchmark-1.9.2.patch   | 40 ++++++++++++++++++++++
 sci-libs/rocThrust/rocThrust-6.4.3.ebuild          |  5 +--
 2 files changed, 43 insertions(+), 2 deletions(-)

diff --git a/sci-libs/rocThrust/files/rocThrust-6.4.3-gbenchmark-1.9.2.patch 
b/sci-libs/rocThrust/files/rocThrust-6.4.3-gbenchmark-1.9.2.patch
new file mode 100644
index 000000000000..194898d3ee23
--- /dev/null
+++ b/sci-libs/rocThrust/files/rocThrust-6.4.3-gbenchmark-1.9.2.patch
@@ -0,0 +1,40 @@
+Fix compilation with Google Benchmark >= 1.9.2
+
+Bug: https://bugs.gentoo.org/960483
+--- a/benchmarks/bench_utils/custom_reporter.hpp
++++ b/benchmarks/bench_utils/custom_reporter.hpp
+@@ -88,6 +88,21 @@ static std::string FormatString(const char* msg, ...)
+     return tmp;
+ }
+ 
++// 'run.memory_result' is a pointer (Google Benchmark < 1.9.2).
++inline const benchmark::MemoryManager::Result*
++GetMemoryResultPtr(const benchmark::MemoryManager::Result* p) {
++    return p;
++}
++
++// 'run.memory_result' is an object (Google Benchmark >= 1.9.2).
++inline const benchmark::MemoryManager::Result*
++GetMemoryResultPtr(const benchmark::MemoryManager::Result& v) {
++    if (v.memory_iterations > 0) {
++        return &v;
++    }
++    return nullptr;
++}
++
+ std::string get_complexity(const benchmark::BigO& complexity)
+ {
+     switch(complexity)
+@@ -658,9 +673,10 @@ class CustomJSONReporter : public benchmark::JSONReporter
+             }
+         }
+ 
+-        if (run.memory_result)
++        const benchmark::MemoryManager::Result* mem_result = 
GetMemoryResultPtr(run.memory_result);
++        if (mem_result)
+         {
+-            const benchmark::MemoryManager::Result memory_result = 
*run.memory_result;
++            const benchmark::MemoryManager::Result& memory_result = 
*mem_result;
+             output_format("allocs_per_iter", run.allocs_per_iter);
+             output_format("max_bytes_used", memory_result.max_bytes_used);
+ 

diff --git a/sci-libs/rocThrust/rocThrust-6.4.3.ebuild 
b/sci-libs/rocThrust/rocThrust-6.4.3.ebuild
index 19b0c8aeca94..0ac52a4cf406 100644
--- a/sci-libs/rocThrust/rocThrust-6.4.3.ebuild
+++ b/sci-libs/rocThrust/rocThrust-6.4.3.ebuild
@@ -26,11 +26,11 @@ REQUIRED_USE="
 
 RESTRICT="!test? ( test )"
 
-RDEPEND="dev-util/hip
+RDEPEND="dev-util/hip:${SLOT}
        sci-libs/rocPRIM:${SLOT}
        test? ( dev-cpp/gtest )
        benchmark? (
-               dev-cpp/benchmark
+               dev-cpp/benchmark:=
                sci-libs/rocRAND:${SLOT}
        )
 "
@@ -44,6 +44,7 @@ PATCHES=(
        "${FILESDIR}/${PN}-4.0-operator_new.patch"
        "${FILESDIR}/${PN}-6.4.1-fix-libcxx.patch"
        "${FILESDIR}/${PN}-6.4.1-no-tests-install.patch"
+       "${FILESDIR}/${PN}-6.4.3-gbenchmark-1.9.2.patch"
 )
 
 src_prepare() {

Reply via email to