git: 1ce05fa8c786 - main - graphics/art: Add workaround for OpenMP-related crash when OPENMP=yes

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Fri, 21 Jan 2022 17:15:15 UTC
The branch main has been updated by yuri:

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

commit 1ce05fa8c786ebde753b240789e4a30b484cda29
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2022-01-21 17:06:26 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2022-01-21 17:14:38 +0000

    graphics/art: Add workaround for OpenMP-related crash when OPENMP=yes
---
 graphics/art/Makefile                      |  4 ++--
 graphics/art/files/patch-rtgui_main-cli.cc | 13 +++++++++++++
 graphics/art/files/patch-rtgui_main.cc     | 13 +++++++++++++
 3 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/graphics/art/Makefile b/graphics/art/Makefile
index 75e268f76027..f2e9330ac193 100644
--- a/graphics/art/Makefile
+++ b/graphics/art/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	art
 DISTVERSION=	1.12
+PORTREVISION=	1
 CATEGORIES=	graphics
 MASTER_SITES=	https://bitbucket.org/agriggio/art/downloads/
 PKGNAMESUFFIX=	-raw-image-editor
@@ -33,10 +34,9 @@ USE_XORG=	x11
 EXTRACT_CMD=	gtar
 
 OPTIONS_DEFINE=		OPENMP
-OPTIONS_DEFAULT=	# OPENMP
+OPTIONS_DEFAULT=	OPENMP
 
 OPENMP_CMAKE_BOOL=	OPTION_OMP
-OPENMP_BROKEN=		OpenMP multithreading is broken, see https://bitbucket.org/agriggio/art/issues/227
 
 post-install:
 	${RM} -r ${STAGEDIR}${PREFIX}/share/doc/ART
diff --git a/graphics/art/files/patch-rtgui_main-cli.cc b/graphics/art/files/patch-rtgui_main-cli.cc
new file mode 100644
index 000000000000..9352255b9360
--- /dev/null
+++ b/graphics/art/files/patch-rtgui_main-cli.cc
@@ -0,0 +1,13 @@
+- workaround for https://bitbucket.org/agriggio/art/issues/227 caused by https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=261360
+
+--- rtgui/main-cli.cc.orig	2022-01-20 17:13:45 UTC
++++ rtgui/main-cli.cc
+@@ -121,6 +121,8 @@ std::pair<bool, bool> dontLoadCache(int argc, char **a
+ 
+ int main (int argc, char **argv)
+ {
++	setenv("LIBOMP_NUM_HIDDEN_HELPER_THREADS", "0", 1);
++
+ #ifdef WITH_MIMALLOC
+     mi_version();
+ #endif
diff --git a/graphics/art/files/patch-rtgui_main.cc b/graphics/art/files/patch-rtgui_main.cc
new file mode 100644
index 000000000000..a0f2b59ca423
--- /dev/null
+++ b/graphics/art/files/patch-rtgui_main.cc
@@ -0,0 +1,13 @@
+- workaround for https://bitbucket.org/agriggio/art/issues/227 caused by https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=261360
+
+--- rtgui/main.cc.orig	2022-01-20 17:14:43 UTC
++++ rtgui/main.cc
+@@ -370,6 +370,8 @@ void show_gimp_plugin_info_dialog(Gtk::Window *parent)
+ 
+ int main (int argc, char **argv)
+ {
++	setenv("LIBOMP_NUM_HIDDEN_HELPER_THREADS", "0", 1);
++
+ #ifdef WITH_MIMALLOC
+     mi_version();
+ #endif