git: 8c86204b79a2 - 2023Q2 - games/anki: Fix crashes with nVidia drivers

From: Kai Knoblich <kai_at_FreeBSD.org>
Date: Tue, 02 May 2023 06:43:02 UTC
The branch 2023Q2 has been updated by kai:

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

commit 8c86204b79a203a15bd18017e306bc6d08a0305a
Author:     Kai Knoblich <kai@FreeBSD.org>
AuthorDate: 2023-05-02 06:34:24 +0000
Commit:     Kai Knoblich <kai@FreeBSD.org>
CommitDate: 2023-05-02 06:41:49 +0000

    games/anki: Fix crashes with nVidia drivers
    
    * Prevent Anki from explicitly loading "libGL.so.1", which leads to
      segfaults in environments that have nVidia drivers in use.
    
    * Bump PORTREVISION due package change.
    
    PR:             270778
    Reported by:    bitbucket63-it@yahoo.com
    MFH:            2023Q2
    
    (cherry picked from commit bdcfffd8573e09ef4c838b3dd1444fa15e508c4e)
---
 games/anki/Makefile                           |  2 +-
 games/anki/files/patch-qt_aqt_____init____.py | 13 +++++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/games/anki/Makefile b/games/anki/Makefile
index 5fc8c01aaa4a..153ea7eee848 100644
--- a/games/anki/Makefile
+++ b/games/anki/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	anki
 DISTVERSION=	2.1.54
-PORTREVISION=	14
+PORTREVISION=	17
 # Don't forget to update ${_MY_BUILDHASH} if DISTVERSION changes
 CATEGORIES=	games education python
 MASTER_SITES=	LOCAL/kai/:yarncache \
diff --git a/games/anki/files/patch-qt_aqt_____init____.py b/games/anki/files/patch-qt_aqt_____init____.py
new file mode 100644
index 000000000000..6428c77633ba
--- /dev/null
+++ b/games/anki/files/patch-qt_aqt_____init____.py
@@ -0,0 +1,13 @@
+Prevents runtime issues with nVidia drivers
+
+--- qt/aqt/__init__.py.orig	2023-04-15 12:54:44 UTC
++++ qt/aqt/__init__.py
+@@ -369,7 +369,7 @@ def setupGL(pm: aqt.profiles.ProfileManager) -> None:
+     driver = pm.video_driver()
+ 
+     # work around pyqt loading wrong GL library
+-    if is_lin:
++    if is_lin and not sys.platform.startswith("freebsd"):
+         import ctypes
+ 
+         ctypes.CDLL("libGL.so.1", ctypes.RTLD_GLOBAL)