git: c214c3d4aee6 - main - emulators/rpcs3: add -qt6 flavor

From: Jan Beich <jbeich_at_FreeBSD.org>
Date: Wed, 02 Nov 2022 19:29:02 UTC
The branch main has been updated by jbeich:

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

commit c214c3d4aee6e42e63eb04cedb2b5e44e8a171eb
Author:     Jan Beich <jbeich@FreeBSD.org>
AuthorDate: 2022-11-02 14:54:26 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2022-11-02 19:28:11 +0000

    emulators/rpcs3: add -qt6 flavor
    
    Based on upstream patch. Once merged, Qt5 won't be supported.
---
 emulators/rpcs3/Makefile        | 23 +++++++++++++++++++++++
 emulators/rpcs3/distinfo        |  2 ++
 emulators/rpcs3/pkg-message.qt6 | 24 ++++++++++++++++++++++++
 3 files changed, 49 insertions(+)

diff --git a/emulators/rpcs3/Makefile b/emulators/rpcs3/Makefile
index ea9fe21e6d29..76f57f49c593 100644
--- a/emulators/rpcs3/Makefile
+++ b/emulators/rpcs3/Makefile
@@ -13,6 +13,8 @@ LICENSE_COMB=	multi
 LICENSE_FILE_ISCL=	${WRKSRC_cubeb}/LICENSE
 LICENSE_FILE_ZLIB=	${WRKSRC_asmjit}/LICENSE.md
 
+FLAVORS=	qt5 qt6
+
 BUILD_DEPENDS=	flatc:devel/flatbuffers
 LIB_DEPENDS=	libxxhash.so:devel/xxhash \
 		libcurl.so:ftp/curl \
@@ -47,6 +49,27 @@ CMAKE_OFF=	USE_NATIVE_INSTRUCTIONS USE_PRECOMPILED_HEADERS
 LDFLAGS+=	-Wl,--as-needed # GLU
 ELF_FEATURES=	+noaslr,wxneeded:bin/${PORTNAME}
 
+.if ${FLAVOR:U} == qt6 || make(makesum) || make(fetch)
+PATCH_SITES+=	https://github.com/${GH_ACCOUNT}/${GH_PROJECT}/commit/:qt6
+PATCHFILES+=	052d8cceb679.patch:-p1:qt6 # https://github.com/RPCS3/rpcs3/pull/12471
+PKGNAMESUFFIX=	-${FLAVOR}
+USES:=		${USES:S/qt:5/qt:6/}
+USE_QT=		base multimedia svg
+PKGMESSAGE=	${.CURDIR}/pkg-message.${FLAVOR}
+
+CONFLICTS_INSTALL=	${PORTNAME}
+
+post-patch:	${FLAVOR}-post-patch
+${FLAVOR}-post-patch:
+# patch(1) doesn't support renames unlike git-apply(1)
+	@${MV}  ${WRKSRC}/rpcs3/rpcs3qt/qt_camera_video_surface.cpp \
+		${WRKSRC}/rpcs3/rpcs3qt/qt_camera_video_sink.cpp
+	@${MV}  ${WRKSRC}/rpcs3/rpcs3qt/qt_camera_video_surface.h \
+		${WRKSRC}/rpcs3/rpcs3qt/qt_camera_video_sink.h
+.else
+CONFLICTS_INSTALL=	${PORTNAME}-qt6
+.endif
+
 OPTIONS_DEFINE=	ALSA EVDEV FAUDIO PULSEAUDIO JACK SNDIO VULKAN
 OPTIONS_DEFAULT=EVDEV FAUDIO PULSEAUDIO JACK SNDIO VULKAN
 
diff --git a/emulators/rpcs3/distinfo b/emulators/rpcs3/distinfo
index 9f59f45db5d0..4af2988fa1be 100644
--- a/emulators/rpcs3/distinfo
+++ b/emulators/rpcs3/distinfo
@@ -23,3 +23,5 @@ SHA256 (wolfSSL-wolfssl-v5.4.0-stable_GH0.tar.gz) = dc36cc19dad197253e5c2ecaa490
 SIZE (wolfSSL-wolfssl-v5.4.0-stable_GH0.tar.gz) = 20972285
 SHA256 (llvm-llvm-project-llvmorg-13.0.1-rc1_GH0.tar.gz) = c9411f1882eaf0c190fd5b412deb0bd7dba61a48df243d3408298cc6f53b6921
 SIZE (llvm-llvm-project-llvmorg-13.0.1-rc1_GH0.tar.gz) = 147284646
+SHA256 (052d8cceb679.patch) = 5e8e600ca1a6889a4f19b574275af1379a7c0b57de776f4d955dc95fdcb2c973
+SIZE (052d8cceb679.patch) = 111096
diff --git a/emulators/rpcs3/pkg-message.qt6 b/emulators/rpcs3/pkg-message.qt6
new file mode 100644
index 000000000000..b2171411dfd0
--- /dev/null
+++ b/emulators/rpcs3/pkg-message.qt6
@@ -0,0 +1,24 @@
+{ type: install
+  message: <<EOM
+Default output selection is broken in qt6-multimedia. To workaround RPCS3 crash
+on game start open Settings -> Audio -> Music Handler then change Qt to Null.
+
+Process 84361 stopped
+* thread #1, name = 'rpcs3', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
+    frame #0: 0x0000000805112583 libQt6Multimedia.so.6`QMediaDevices::audioOutputs() at qmediadevices.cpp:133:47
+   130  */
+   131  QList<QAudioDevice> QMediaDevices::audioOutputs()
+   132  {
+-> 133      return QPlatformMediaDevices::instance()->audioOutputs();
+   134  }
+   135
+   136  /*!
+(lldb) bt
+* thread #1, name = 'rpcs3', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
+  * frame #0: 0x0000000805112583 libQt6Multimedia.so.6`QMediaDevices::audioOutputs() at qmediadevices.cpp:133:47
+    frame #1: 0x000000080511274e libQt6Multimedia.so.6`QMediaDevices::defaultAudioOutput() at qmediadevices.cpp:190:26
+    frame #2: 0x00000008050c86ef libQt6Multimedia.so.6`QAudioOutput::QAudioOutput(this=0x0000000899ff05e0, parent=0x0000000000000000) at qaudiooutput.cpp:54:20
+[...]
+EOM
+}
+]