git: f89277b84f49 - main - graphics/dust3d: fix build on powerpc and riscv64

From: Piotr Kubaj <pkubaj_at_FreeBSD.org>
Date: Fri, 24 Dec 2021 19:18:20 UTC
The branch main has been updated by pkubaj:

URL: https://cgit.FreeBSD.org/ports/commit/?id=f89277b84f49ac4d7a8656c44ff4e25e3293c116

commit f89277b84f49ac4d7a8656c44ff4e25e3293c116
Author:     Piotr Kubaj <pkubaj@FreeBSD.org>
AuthorDate: 2021-12-24 19:10:57 +0000
Commit:     Piotr Kubaj <pkubaj@FreeBSD.org>
CommitDate: 2021-12-24 19:10:57 +0000

    graphics/dust3d: fix build on powerpc and riscv64
    
    Same issue as devel/onetbb.
---
 graphics/dust3d/Makefile                                      |  6 ++++++
 ...shes-dust3d_ext_tbb_src_tbb_tools__api_ittnotify__config.h | 11 +++++++++++
 2 files changed, 17 insertions(+)

diff --git a/graphics/dust3d/Makefile b/graphics/dust3d/Makefile
index 33544500a1bb..16f117615b79 100644
--- a/graphics/dust3d/Makefile
+++ b/graphics/dust3d/Makefile
@@ -30,6 +30,12 @@ DESKTOP_ENTRIES="Dust3D" "${COMMENT}" "${PORTNAME}" "${PORTNAME}" \
 
 PLIST_FILES=	bin/${PORTNAME}
 
+.include <bsd.port.options.mk>
+
+.if ${ARCH} == powerpc || ${ARCH} == riscv64
+EXTRA_PATCHES=	${FILESDIR}/extra-patch-thirdparty_instant-meshes_instant-meshes-dust3d_ext_tbb_src_tbb_tools__api_ittnotify__config.h
+.endif
+
 post-patch:
 	@${REINPLACE_CMD} -e '/PLATFORM =/s,Linux,${OPSYS},' \
 		${WRKSRC}/${PORTNAME}.pro
diff --git a/graphics/dust3d/files/extra-patch-thirdparty_instant-meshes_instant-meshes-dust3d_ext_tbb_src_tbb_tools__api_ittnotify__config.h b/graphics/dust3d/files/extra-patch-thirdparty_instant-meshes_instant-meshes-dust3d_ext_tbb_src_tbb_tools__api_ittnotify__config.h
new file mode 100644
index 000000000000..cb95787669b4
--- /dev/null
+++ b/graphics/dust3d/files/extra-patch-thirdparty_instant-meshes_instant-meshes-dust3d_ext_tbb_src_tbb_tools__api_ittnotify__config.h
@@ -0,0 +1,11 @@
+--- thirdparty/instant-meshes/instant-meshes-dust3d/ext/tbb/src/tbb/tools_api/ittnotify_config.h.orig	2021-06-30 18:42:09 UTC
++++ thirdparty/instant-meshes/instant-meshes-dust3d/ext/tbb/src/tbb/tools_api/ittnotify_config.h
+@@ -335,7 +335,7 @@ ITT_INLINE long
+ __itt_interlocked_increment(volatile long* ptr) ITT_INLINE_ATTRIBUTE;
+ ITT_INLINE long __itt_interlocked_increment(volatile long* ptr)
+ {
+-    return __TBB_machine_fetchadd4(ptr, 1) + 1L;
++    return __atomic_fetch_add(ptr, 1L, __ATOMIC_SEQ_CST) + 1L;
+ }
+ #endif /* ITT_SIMPLE_INIT */
+