git: 8453bb804576 - main - multimedia/qt6-multimedia: respect upstream defaults

From: Jan Beich <jbeich_at_FreeBSD.org>
Date: Thu, 23 Feb 2023 10:19:54 UTC
The branch main has been updated by jbeich:

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

commit 8453bb8045763566a33792d9b4ea3d8dbbec4426
Author:     Jan Beich <jbeich@FreeBSD.org>
AuthorDate: 2023-02-23 07:00:32 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2023-02-23 10:19:32 +0000

    multimedia/qt6-multimedia: respect upstream defaults
    
    Expose auto-detected dependencies as options to make builds deterministic.
    Disabling all audio backends is forbidden to avoid crashes as upstream
    doesn't test a configuration that cannot happen on Android, macOS, Windows,
    QNX or desktop Linux (except Gentoo).
    
    PR:             268876
    Approved by:    portmgr blanket, maintainer timeout (partially: no patch but no help)
---
 emulators/rpcs3/Makefile                           |  2 +-
 emulators/rpcs3/pkg-message.qt6                    | 25 ----------
 multimedia/qt6-multimedia/Makefile                 | 47 ++++++++++++++++--
 .../files/patch-src_multimedia_configure.cmake     | 11 +++++
 ...-src_plugins_multimedia_ffmpeg_qv4l2camera__p.h | 11 +++++
 multimedia/qt6-multimedia/pkg-plist                | 57 +++++++++++++++++++---
 6 files changed, 116 insertions(+), 37 deletions(-)

diff --git a/emulators/rpcs3/Makefile b/emulators/rpcs3/Makefile
index b6bdbfeef7d8..879097ddad20 100644
--- a/emulators/rpcs3/Makefile
+++ b/emulators/rpcs3/Makefile
@@ -2,6 +2,7 @@ PORTNAME=	rpcs3
 DISTVERSIONPREFIX=	v
 DISTVERSION=	0.0.26-14743 # git rev-list --count HEAD
 DISTVERSIONSUFFIX=	-g6b30cdac09
+PORTREVISION=	1
 CATEGORIES=	emulators wayland
 
 MAINTAINER=	jbeich@FreeBSD.org
@@ -56,7 +57,6 @@ PATCHFILES+=	04a0a2e258d0.patch:-p1:qt6 # https://github.com/RPCS3/rpcs3/pull/12
 PKGNAMESUFFIX=	-${FLAVOR}
 USES:=		${USES:S/qt:5/qt:6/}
 USE_QT=		base multimedia svg
-PKGMESSAGE=	${.CURDIR}/pkg-message.${FLAVOR}
 
 CONFLICTS_INSTALL=	${PORTNAME}
 
diff --git a/emulators/rpcs3/pkg-message.qt6 b/emulators/rpcs3/pkg-message.qt6
deleted file mode 100644
index a9d4e9bcf499..000000000000
--- a/emulators/rpcs3/pkg-message.qt6
+++ /dev/null
@@ -1,25 +0,0 @@
-[
-{ 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
-}
-]
diff --git a/multimedia/qt6-multimedia/Makefile b/multimedia/qt6-multimedia/Makefile
index 63ca7a9b6898..c04c54d8c1e4 100644
--- a/multimedia/qt6-multimedia/Makefile
+++ b/multimedia/qt6-multimedia/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	multimedia
 PORTVERSION=	${QT6_VERSION}
+PORTREVISION=	1
 CATEGORIES=	multimedia
 PKGNAMEPREFIX=	qt6-
 
@@ -10,14 +11,52 @@ WWW=		https://qt.io
 BUILD_DEPENDS=	vulkan-headers>0:graphics/vulkan-headers
 LIB_DEPENDS=	libxkbcommon.so:x11/libxkbcommon
 
-USES=		cmake compiler:c++11-lang gl gnome gstreamer:1 localbase:ldflags \
-		pkgconfig qt-dist:6
+USES=		cmake compiler:c++11-lang gl localbase:ldflags pkgconfig qt-dist:6
 USE_GL=		gl opengl
-USE_GNOME=	glib20
-USE_GSTREAMER=	bad gl good ugly
 USE_QT=		base declarative shadertools svg
 
 CXXFLAGS_powerpc64=	-mvsx
 CFLAGS_powerpc=	-DPFFFT_SIMD_DISABLE
 
+OPTIONS_DEFINE=	FFMPEG GSTREAMER Q3D V4L VAAPI
+OPTIONS_DEFAULT=FFMPEG GSTREAMER PULSEAUDIO Q3D V4L VAAPI
+OPTIONS_SINGLE=	AUDIO
+OPTIONS_SINGLE_AUDIO=	ALSA PULSEAUDIO
+OPTIONS_SUB=	yes
+
+AUDIO_DESC=		Low level Audio Backend
+
+ALSA_LIB_DEPENDS=	libasound.so:audio/alsa-lib
+ALSA_CMAKE_BOOL=	FEATURE_alsa
+
+FFMPEG_LIB_DEPENDS=	libavcodec.so:multimedia/ffmpeg
+FFMPEG_CMAKE_BOOL=	FEATURE_ffmpeg
+
+GSTREAMER_USES=		gnome gstreamer:1
+GSTREAMER_USE=		GL=egl GNOME=glib20 GSTREAMER=bad,gl,good,ugly
+GSTREAMER_CMAKE_BOOL=	FEATURE_gstreamer
+
+PULSEAUDIO_LIB_DEPENDS=	libpulse.so:audio/pulseaudio
+PULSEAUDIO_CMAKE_BOOL=	FEATURE_pulseaudio
+
+Q3D_DESC=		Spatial Audio via Quick3D
+Q3D_USE=		QT=quick3d
+Q3D_CMAKE_BOOL=		FEATURE_spatialaudio_quick3d
+
+V4L_BUILD_DEPENDS=	v4l_compat>0:multimedia/v4l_compat
+V4L_CMAKE_BOOL=		FEATURE_linux_v4l
+V4L_IMPLIES=		${"${PORT_OPTIONS:MFFMPEG}":?FFMPEG:GSTREAMER}
+
+VAAPI_LIB_DEPENDS=	libva.so:multimedia/libva
+VAAPI_USE=		GL=egl
+VAAPI_CMAKE_BOOL=	FEATURE_vaapi
+VAAPI_IMPLIES=		FFMPEG
+
+.include <bsd.port.options.mk>
+
+post-install:
+.if !(${PORT_OPTIONS:MFFMPEG} || ${PORT_OPTIONS:MGSTREAMER})
+	@${REINPLACE_CMD} '/MultimediaPlugins\.cmake/d' ${TMPPLIST}
+.endif
+
 .include <bsd.port.mk>
diff --git a/multimedia/qt6-multimedia/files/patch-src_multimedia_configure.cmake b/multimedia/qt6-multimedia/files/patch-src_multimedia_configure.cmake
new file mode 100644
index 000000000000..690fae6320f6
--- /dev/null
+++ b/multimedia/qt6-multimedia/files/patch-src_multimedia_configure.cmake
@@ -0,0 +1,11 @@
+--- src/multimedia/configure.cmake.orig	2022-12-12 19:36:40 UTC
++++ src/multimedia/configure.cmake
+@@ -73,7 +73,7 @@ qt_feature("ffmpeg" PRIVATE
+     LABEL "FFmpeg"
+     ENABLE INPUT_ffmpeg STREQUAL 'yes'
+     DISABLE INPUT_ffmpeg STREQUAL 'no'
+-    CONDITION FFmpeg_FOUND AND (APPLE OR WIN32 OR ANDROID OR QNX OR QT_FEATURE_pulseaudio)
++    CONDITION FFmpeg_FOUND AND (APPLE OR WIN32 OR ANDROID OR QNX OR QT_FEATURE_alsa OR QT_FEATURE_pulseaudio)
+ )
+ qt_feature("alsa" PUBLIC PRIVATE
+     LABEL "ALSA (experimental)"
diff --git a/multimedia/qt6-multimedia/files/patch-src_plugins_multimedia_ffmpeg_qv4l2camera__p.h b/multimedia/qt6-multimedia/files/patch-src_plugins_multimedia_ffmpeg_qv4l2camera__p.h
new file mode 100644
index 000000000000..e55cab937398
--- /dev/null
+++ b/multimedia/qt6-multimedia/files/patch-src_plugins_multimedia_ffmpeg_qv4l2camera__p.h
@@ -0,0 +1,11 @@
+--- src/plugins/multimedia/ffmpeg/qv4l2camera_p.h.orig	2022-12-12 19:36:40 UTC
++++ src/plugins/multimedia/ffmpeg/qv4l2camera_p.h
+@@ -23,6 +23,8 @@
+ #include <qsocketnotifier.h>
+ #include <qmutex.h>
+ 
++#include <sys/time.h> // timeval
++
+ QT_BEGIN_NAMESPACE
+ 
+ class QV4L2CameraDevices : public QObject,
diff --git a/multimedia/qt6-multimedia/pkg-plist b/multimedia/qt6-multimedia/pkg-plist
index d9cc41b371b9..6d4fb1b1f5e7 100644
--- a/multimedia/qt6-multimedia/pkg-plist
+++ b/multimedia/qt6-multimedia/pkg-plist
@@ -157,6 +157,18 @@
 %%QT_INCDIR%%/QtMultimediaWidgets/qtmultimediawidgetsglobal.h
 %%QT_INCDIR%%/QtMultimediaWidgets/qtmultimediawidgetsversion.h
 %%QT_INCDIR%%/QtMultimediaWidgets/qvideowidget.h
+%%Q3D%%%%QT_INCDIR%%/QtQuick3DSpatialAudio/%%FULLVER%%/QtQuick3DSpatialAudio/private/qquick3dambientsound_p.h
+%%Q3D%%%%QT_INCDIR%%/QtQuick3DSpatialAudio/%%FULLVER%%/QtQuick3DSpatialAudio/private/qquick3daudioengine_p.h
+%%Q3D%%%%QT_INCDIR%%/QtQuick3DSpatialAudio/%%FULLVER%%/QtQuick3DSpatialAudio/private/qquick3daudiolistener_p.h
+%%Q3D%%%%QT_INCDIR%%/QtQuick3DSpatialAudio/%%FULLVER%%/QtQuick3DSpatialAudio/private/qquick3daudioroom_p.h
+%%Q3D%%%%QT_INCDIR%%/QtQuick3DSpatialAudio/%%FULLVER%%/QtQuick3DSpatialAudio/private/qquick3dspatialsound_p.h
+%%Q3D%%%%QT_INCDIR%%/QtQuick3DSpatialAudio/%%FULLVER%%/QtQuick3DSpatialAudio/private/qtquick3daudioglobal_p.h
+%%Q3D%%%%QT_INCDIR%%/QtQuick3DSpatialAudio/%%FULLVER%%/QtQuick3DSpatialAudio/private/qtquick3daudiotypes_p.h
+%%Q3D%%%%QT_INCDIR%%/QtQuick3DSpatialAudio/QtQuick3DSpatialAudio
+%%Q3D%%%%QT_INCDIR%%/QtQuick3DSpatialAudio/QtQuick3DSpatialAudioDepends
+%%Q3D%%%%QT_INCDIR%%/QtQuick3DSpatialAudio/QtQuick3DSpatialAudioVersion
+%%Q3D%%%%QT_INCDIR%%/QtQuick3DSpatialAudio/qtquick3dspatialaudioexports.h
+%%Q3D%%%%QT_INCDIR%%/QtQuick3DSpatialAudio/qtquick3dspatialaudioversion.h
 %%QT_INCDIR%%/QtSpatialAudio/%%FULLVER%%/QtSpatialAudio/private/qambisonicdecoder_p.h
 %%QT_INCDIR%%/QtSpatialAudio/%%FULLVER%%/QtSpatialAudio/private/qambisonicdecoderdata_p.h
 %%QT_INCDIR%%/QtSpatialAudio/%%FULLVER%%/QtSpatialAudio/private/qaudioengine_p.h
@@ -206,12 +218,18 @@ lib/cmake/Qt6Multimedia/Qt6MultimediaPlugins.cmake
 lib/cmake/Qt6Multimedia/Qt6MultimediaTargets-%%CMAKE_BUILD_TYPE%%.cmake
 lib/cmake/Qt6Multimedia/Qt6MultimediaTargets.cmake
 lib/cmake/Qt6Multimedia/Qt6MultimediaVersionlessTargets.cmake
-lib/cmake/Qt6Multimedia/Qt6QGstreamerMediaPluginAdditionalTargetInfo.cmake
-lib/cmake/Qt6Multimedia/Qt6QGstreamerMediaPluginConfig.cmake
-lib/cmake/Qt6Multimedia/Qt6QGstreamerMediaPluginConfigVersion.cmake
-lib/cmake/Qt6Multimedia/Qt6QGstreamerMediaPluginConfigVersionImpl.cmake
-lib/cmake/Qt6Multimedia/Qt6QGstreamerMediaPluginTargets-%%CMAKE_BUILD_TYPE%%.cmake
-lib/cmake/Qt6Multimedia/Qt6QGstreamerMediaPluginTargets.cmake
+%%FFMPEG%%lib/cmake/Qt6Multimedia/Qt6QFFmpegMediaPluginAdditionalTargetInfo.cmake
+%%FFMPEG%%lib/cmake/Qt6Multimedia/Qt6QFFmpegMediaPluginConfig.cmake
+%%FFMPEG%%lib/cmake/Qt6Multimedia/Qt6QFFmpegMediaPluginConfigVersion.cmake
+%%FFMPEG%%lib/cmake/Qt6Multimedia/Qt6QFFmpegMediaPluginConfigVersionImpl.cmake
+%%FFMPEG%%lib/cmake/Qt6Multimedia/Qt6QFFmpegMediaPluginTargets-%%CMAKE_BUILD_TYPE%%.cmake
+%%FFMPEG%%lib/cmake/Qt6Multimedia/Qt6QFFmpegMediaPluginTargets.cmake
+%%GSTREAMER%%lib/cmake/Qt6Multimedia/Qt6QGstreamerMediaPluginAdditionalTargetInfo.cmake
+%%GSTREAMER%%lib/cmake/Qt6Multimedia/Qt6QGstreamerMediaPluginConfig.cmake
+%%GSTREAMER%%lib/cmake/Qt6Multimedia/Qt6QGstreamerMediaPluginConfigVersion.cmake
+%%GSTREAMER%%lib/cmake/Qt6Multimedia/Qt6QGstreamerMediaPluginConfigVersionImpl.cmake
+%%GSTREAMER%%lib/cmake/Qt6Multimedia/Qt6QGstreamerMediaPluginTargets-%%CMAKE_BUILD_TYPE%%.cmake
+%%GSTREAMER%%lib/cmake/Qt6Multimedia/Qt6QGstreamerMediaPluginTargets.cmake
 lib/cmake/Qt6MultimediaQuickPrivate/Qt6MultimediaQuickPrivateAdditionalTargetInfo.cmake
 lib/cmake/Qt6MultimediaQuickPrivate/Qt6MultimediaQuickPrivateConfig.cmake
 lib/cmake/Qt6MultimediaQuickPrivate/Qt6MultimediaQuickPrivateConfigVersion.cmake
@@ -228,12 +246,26 @@ lib/cmake/Qt6MultimediaWidgets/Qt6MultimediaWidgetsDependencies.cmake
 lib/cmake/Qt6MultimediaWidgets/Qt6MultimediaWidgetsTargets-%%CMAKE_BUILD_TYPE%%.cmake
 lib/cmake/Qt6MultimediaWidgets/Qt6MultimediaWidgetsTargets.cmake
 lib/cmake/Qt6MultimediaWidgets/Qt6MultimediaWidgetsVersionlessTargets.cmake
+%%Q3D%%lib/cmake/Qt6Qml/QmlPlugins/Qt6quick3dspatialaudioAdditionalTargetInfo.cmake
+%%Q3D%%lib/cmake/Qt6Qml/QmlPlugins/Qt6quick3dspatialaudioConfig.cmake
+%%Q3D%%lib/cmake/Qt6Qml/QmlPlugins/Qt6quick3dspatialaudioConfigVersion.cmake
+%%Q3D%%lib/cmake/Qt6Qml/QmlPlugins/Qt6quick3dspatialaudioConfigVersionImpl.cmake
+%%Q3D%%lib/cmake/Qt6Qml/QmlPlugins/Qt6quick3dspatialaudioTargets-%%CMAKE_BUILD_TYPE%%.cmake
+%%Q3D%%lib/cmake/Qt6Qml/QmlPlugins/Qt6quick3dspatialaudioTargets.cmake
 lib/cmake/Qt6Qml/QmlPlugins/Qt6quickmultimediaAdditionalTargetInfo.cmake
 lib/cmake/Qt6Qml/QmlPlugins/Qt6quickmultimediaConfig.cmake
 lib/cmake/Qt6Qml/QmlPlugins/Qt6quickmultimediaConfigVersion.cmake
 lib/cmake/Qt6Qml/QmlPlugins/Qt6quickmultimediaConfigVersionImpl.cmake
 lib/cmake/Qt6Qml/QmlPlugins/Qt6quickmultimediaTargets-%%CMAKE_BUILD_TYPE%%.cmake
 lib/cmake/Qt6Qml/QmlPlugins/Qt6quickmultimediaTargets.cmake
+%%Q3D%%lib/cmake/Qt6Quick3DSpatialAudioPrivate/Qt6Quick3DSpatialAudioPrivateAdditionalTargetInfo.cmake
+%%Q3D%%lib/cmake/Qt6Quick3DSpatialAudioPrivate/Qt6Quick3DSpatialAudioPrivateConfig.cmake
+%%Q3D%%lib/cmake/Qt6Quick3DSpatialAudioPrivate/Qt6Quick3DSpatialAudioPrivateConfigVersion.cmake
+%%Q3D%%lib/cmake/Qt6Quick3DSpatialAudioPrivate/Qt6Quick3DSpatialAudioPrivateConfigVersionImpl.cmake
+%%Q3D%%lib/cmake/Qt6Quick3DSpatialAudioPrivate/Qt6Quick3DSpatialAudioPrivateDependencies.cmake
+%%Q3D%%lib/cmake/Qt6Quick3DSpatialAudioPrivate/Qt6Quick3DSpatialAudioPrivateTargets-%%CMAKE_BUILD_TYPE%%.cmake
+%%Q3D%%lib/cmake/Qt6Quick3DSpatialAudioPrivate/Qt6Quick3DSpatialAudioPrivateTargets.cmake
+%%Q3D%%lib/cmake/Qt6Quick3DSpatialAudioPrivate/Qt6Quick3DSpatialAudioPrivateVersionlessTargets.cmake
 lib/cmake/Qt6SpatialAudio/Qt6SpatialAudioAdditionalTargetInfo.cmake
 lib/cmake/Qt6SpatialAudio/Qt6SpatialAudioConfig.cmake
 lib/cmake/Qt6SpatialAudio/Qt6SpatialAudioConfigVersion.cmake
@@ -255,6 +287,10 @@ lib/cmake/Qt6SpatialAudio/Qt6SpatialAudioVersionlessTargets.cmake
 %%QT_LIBDIR%%/libQt6MultimediaWidgets.so
 %%QT_LIBDIR%%/libQt6MultimediaWidgets.so.6
 %%QT_LIBDIR%%/libQt6MultimediaWidgets.so.%%FULLVER%%
+%%Q3D%%%%QT_LIBDIR%%/libQt6Quick3DSpatialAudio.prl
+%%Q3D%%%%QT_LIBDIR%%/libQt6Quick3DSpatialAudio.so
+%%Q3D%%%%QT_LIBDIR%%/libQt6Quick3DSpatialAudio.so.6
+%%Q3D%%%%QT_LIBDIR%%/libQt6Quick3DSpatialAudio.so.%%FULLVER%%
 %%QT_LIBDIR%%/libQt6SpatialAudio.prl
 %%QT_LIBDIR%%/libQt6SpatialAudio.so
 %%QT_LIBDIR%%/libQt6SpatialAudio.so.6
@@ -262,23 +298,30 @@ lib/cmake/Qt6SpatialAudio/Qt6SpatialAudioVersionlessTargets.cmake
 %%QT_LIBDIR%%/metatypes/qt6multimedia_%%CMAKE_BUILD_TYPE%%_metatypes.json
 %%QT_LIBDIR%%/metatypes/qt6multimediaquickprivate_%%CMAKE_BUILD_TYPE%%_metatypes.json
 %%QT_LIBDIR%%/metatypes/qt6multimediawidgets_%%CMAKE_BUILD_TYPE%%_metatypes.json
+%%Q3D%%%%QT_LIBDIR%%/metatypes/qt6quick3dspatialaudioprivate_%%CMAKE_BUILD_TYPE%%_metatypes.json
 %%QT_LIBDIR%%/metatypes/qt6spatialaudio_%%CMAKE_BUILD_TYPE%%_metatypes.json
 %%QT_MKSPECDIR%%/modules/qt_lib_multimedia.pri
 %%QT_MKSPECDIR%%/modules/qt_lib_multimedia_private.pri
 %%QT_MKSPECDIR%%/modules/qt_lib_multimediaquick_private.pri
 %%QT_MKSPECDIR%%/modules/qt_lib_multimediawidgets.pri
 %%QT_MKSPECDIR%%/modules/qt_lib_multimediawidgets_private.pri
+%%Q3D%%%%QT_MKSPECDIR%%/modules/qt_lib_quick3dspatialaudio_private.pri
 %%QT_MKSPECDIR%%/modules/qt_lib_spatialaudio.pri
 %%QT_MKSPECDIR%%/modules/qt_lib_spatialaudio_private.pri
-%%QT_PLUGINDIR%%/multimedia/libgstreamermediaplugin.so
+%%FFMPEG%%%%QT_PLUGINDIR%%/multimedia/libffmpegmediaplugin.so
+%%GSTREAMER%%%%QT_PLUGINDIR%%/multimedia/libgstreamermediaplugin.so
 %%QT_QMLDIR%%/QtMultimedia/Video.qml
 %%QT_QMLDIR%%/QtMultimedia/libquickmultimediaplugin.so
 %%QT_QMLDIR%%/QtMultimedia/plugins.qmltypes
 %%QT_QMLDIR%%/QtMultimedia/qmldir
+%%Q3D%%%%QT_QMLDIR%%/QtQuick3D/SpatialAudio/libquick3dspatialaudioplugin.so
+%%Q3D%%%%QT_QMLDIR%%/QtQuick3D/SpatialAudio/plugins.qmltypes
+%%Q3D%%%%QT_QMLDIR%%/QtQuick3D/SpatialAudio/qmldir
 libdata/pkgconfig/Qt6Multimedia.pc
 libdata/pkgconfig/Qt6MultimediaWidgets.pc
 libdata/pkgconfig/Qt6SpatialAudio.pc
 %%QT_DATADIR%%/modules/Multimedia.json
 %%QT_DATADIR%%/modules/MultimediaQuickPrivate.json
 %%QT_DATADIR%%/modules/MultimediaWidgets.json
+%%Q3D%%%%QT_DATADIR%%/modules/Quick3DSpatialAudioPrivate.json
 %%QT_DATADIR%%/modules/SpatialAudio.json