commit:     64988e18d34d6d84629194aa767ef29ed5521881
Author:     Yixun Lan <dlan <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 18 22:20:45 2022 +0000
Commit:     Yixun Lan <dlan <AT> gentoo <DOT> org>
CommitDate: Fri Feb 18 22:20:45 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=64988e18

media-gfx/openvdb: fix missing atomic lib

this happened on RISC-V platform, but may also
exist in other ARCH, see tracking bug #721344

Closes: https://bugs.gentoo.org/833372
Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Yixun Lan <dlan <AT> gentoo.org>

 .../openvdb/files/openvdb-9.0.0-fix-atomic.patch   | 47 ++++++++++++++++++++++
 media-gfx/openvdb/openvdb-9.0.0-r2.ebuild          |  1 +
 2 files changed, 48 insertions(+)

diff --git a/media-gfx/openvdb/files/openvdb-9.0.0-fix-atomic.patch 
b/media-gfx/openvdb/files/openvdb-9.0.0-fix-atomic.patch
new file mode 100644
index 000000000000..3885bb4ca453
--- /dev/null
+++ b/media-gfx/openvdb/files/openvdb-9.0.0-fix-atomic.patch
@@ -0,0 +1,47 @@
+From 7ca53e00b5f85b8842a2a846f0026d63791498cc Mon Sep 17 00:00:00 2001
+From: Yixun Lan <[email protected]>
+Date: Wed, 16 Feb 2022 22:24:16 +0800
+Subject: [PATCH] openvdb: fix missing atomic lib
+
+explicitly pass -pthread to work around pthread builtin since glibc-2.34,
+as we need -pthread to pull in libatomic for machines like riscv
+
+Bug: https://bugs.gentoo.org/833372
+Original-from: Alex Fan <[email protected]>
+Signed-off-by: Yixun Lan <[email protected]>
+---
+ nanovdb/nanovdb/CMakeLists.txt | 3 +++
+ openvdb/openvdb/CMakeLists.txt | 3 +++
+ 2 files changed, 6 insertions(+)
+
+diff --git a/nanovdb/nanovdb/CMakeLists.txt b/nanovdb/nanovdb/CMakeLists.txt
+index 296dbb0..afc4f0c 100644
+--- a/nanovdb/nanovdb/CMakeLists.txt
++++ b/nanovdb/nanovdb/CMakeLists.txt
+@@ -69,6 +69,9 @@ if(UNIX)
+   # forces the compiler -pthread flag vs -lpthread
+   set(THREADS_PREFER_PTHREAD_FLAG TRUE)
+   find_package(Threads REQUIRED)
++  if(CMAKE_USE_PTHREADS_INIT)
++    target_link_libraries(Threads::Threads INTERFACE -pthread)
++  endif()
+ endif()
+ 
+ if(NANOVDB_BUILD_UNITTESTS OR NANOVDB_BUILD_BENCHMARK)
+diff --git a/openvdb/openvdb/CMakeLists.txt b/openvdb/openvdb/CMakeLists.txt
+index 1d5b75f..22988b7 100644
+--- a/openvdb/openvdb/CMakeLists.txt
++++ b/openvdb/openvdb/CMakeLists.txt
+@@ -202,6 +202,9 @@ endif()
+ 
+ if(UNIX)
+   find_package(Threads REQUIRED)
++  if(CMAKE_USE_PTHREADS_INIT)
++    target_link_libraries(Threads::Threads INTERFACE -pthread)
++  endif()
+ endif()
+ 
+ # Set deps. Note that the order here is important. If we're building against
+-- 
+2.35.1
+

diff --git a/media-gfx/openvdb/openvdb-9.0.0-r2.ebuild 
b/media-gfx/openvdb/openvdb-9.0.0-r2.ebuild
index 7708562fd8be..e1cc1a9a6192 100644
--- a/media-gfx/openvdb/openvdb-9.0.0-r2.ebuild
+++ b/media-gfx/openvdb/openvdb-9.0.0-r2.ebuild
@@ -64,6 +64,7 @@ BDEPEND="
 PATCHES=(
        "${FILESDIR}/${PN}-7.1.0-0001-Fix-multilib-header-source.patch"
        "${FILESDIR}/${PN}-8.1.0-glfw-libdir.patch"
+       "${FILESDIR}/${PN}-9.0.0-fix-atomic.patch"
        "${FILESDIR}/${PN}-9.0.0-numpy.patch"
        
"${FILESDIR}/${PN}-9.0.0-unconditionally-search-Python-interpreter.patch"
 )

Reply via email to