git: 462adef145ea - main - games/moonlight-qt: Open source PC client for NVIDIA GameStream and Sunshine

From: Gleb Popov <arrowd_at_FreeBSD.org>
Date: Mon, 23 Oct 2023 17:31:09 UTC
The branch main has been updated by arrowd:

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

commit 462adef145ea60bb0201aa23f4c3c14c453a97f9
Author:     Gleb Popov <arrowd@FreeBSD.org>
AuthorDate: 2023-10-23 14:53:05 +0000
Commit:     Gleb Popov <arrowd@FreeBSD.org>
CommitDate: 2023-10-23 17:30:56 +0000

    games/moonlight-qt: Open source PC client for NVIDIA GameStream and Sunshine
    
    Differential Revision: https://reviews.freebsd.org/D42323
---
 games/moonlight-qt/Makefile                        | 45 ++++++++++++++++++++++
 games/moonlight-qt/distinfo                        |  3 ++
 ...ch-app_streaming_video_ffmpeg-renderers_drm.cpp | 27 +++++++++++++
 games/moonlight-qt/pkg-descr                       |  3 ++
 4 files changed, 78 insertions(+)

diff --git a/games/moonlight-qt/Makefile b/games/moonlight-qt/Makefile
new file mode 100644
index 000000000000..3bc21934a1c1
--- /dev/null
+++ b/games/moonlight-qt/Makefile
@@ -0,0 +1,45 @@
+PORTNAME=	moonlight
+DISTVERSION=	5.0.0
+CATEGORIES=	games
+MASTER_SITES=	https://github.com/moonlight-stream/moonlight-qt/releases/download/v${DISTVERSION}/
+PKGNAMESUFFIX=	-qt
+DISTNAME=	MoonlightSrc-${DISTVERSIONFULL}
+
+MAINTAINER=	lisp_25689@163.com
+COMMENT=	Gamestream client
+WWW=		https://github.com/moonlight-stream/moonlight-qt
+
+LICENSE=	GPLv3+
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+LIB_DEPENDS=	libavcodec.so:multimedia/ffmpeg \
+		libopus.so:audio/opus \
+		libva.so:multimedia/libva \
+		libdrm.so:graphics/libdrm \
+		libvdpau.so:multimedia/libvdpau \
+		libwayland-client.so:graphics/wayland
+
+USES=		desktop-file-utils gl localbase:ldflags pkgconfig \
+		qmake:outsource qt:5 sdl ssl xorg
+USE_QT=		core declarative gui network quickcontrols2 svg widgets buildtools:build
+USE_GL=		egl
+USE_SDL=	sdl2 ttf2
+USE_XORG=	x11
+
+NO_WRKSUBDIR=	yes
+
+PLIST_FILES=	bin/moonlight-qt \
+		share/applications/com.moonlight_stream.Moonlight.desktop \
+		share/metainfo/com.moonlight_stream.Moonlight.appdata.xml \
+		share/icons/hicolor/scalable/apps/moonlight.svg \
+
+post-patch:
+	@${REINPLACE_CMD} -e 's@^    TARGET = moonlight.*@    TARGET = ${PORTNAME}${PKGNAMESUFFIX}@' \
+		${WRKSRC}/app/app.pro
+	@${REINPLACE_CMD} -e 's@Exec=moonlight.*@Exec=${PORTNAME}${PKGNAMESUFFIX}@' \
+		${WRKSRC}/app/deploy/linux/com.moonlight_stream.Moonlight.desktop
+
+post-install:
+	${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/${PORTNAME}${PKGNAMESUFFIX}
+
+.include <bsd.port.mk>
diff --git a/games/moonlight-qt/distinfo b/games/moonlight-qt/distinfo
new file mode 100644
index 000000000000..f7fb7de29906
--- /dev/null
+++ b/games/moonlight-qt/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1697634805
+SHA256 (MoonlightSrc-5.0.0.tar.gz) = bb376640421cd5386a64102cbb9d78f5be87e8f796b78bf517dca2c8c37acfd4
+SIZE (MoonlightSrc-5.0.0.tar.gz) = 79821343
diff --git a/games/moonlight-qt/files/patch-app_streaming_video_ffmpeg-renderers_drm.cpp b/games/moonlight-qt/files/patch-app_streaming_video_ffmpeg-renderers_drm.cpp
new file mode 100644
index 000000000000..4068c7278a21
--- /dev/null
+++ b/games/moonlight-qt/files/patch-app_streaming_video_ffmpeg-renderers_drm.cpp
@@ -0,0 +1,27 @@
+--- app/streaming/video/ffmpeg-renderers/drm.cpp.orig	2023-10-18 05:45:10 UTC
++++ app/streaming/video/ffmpeg-renderers/drm.cpp
+@@ -10,7 +10,24 @@ extern "C" {
+ }
+ 
+ #include <libdrm/drm_fourcc.h>
++#ifdef __linux__
+ #include <linux/dma-buf.h>
++#else //bundle on BSDs
++typedef uint64_t __u64;
++// From https://github.com/evadot/drm-subtree or https://reviews.freebsd.org/D23085
++struct dma_buf_sync {
++    __u64 flags;
++};
++#define DMA_BUF_SYNC_READ      (1 << 0)
++#define DMA_BUF_SYNC_WRITE     (2 << 0)
++#define DMA_BUF_SYNC_RW        (DMA_BUF_SYNC_READ | DMA_BUF_SYNC_WRITE)
++#define DMA_BUF_SYNC_START     (0 << 2)
++#define DMA_BUF_SYNC_END       (1 << 2)
++#define DMA_BUF_SYNC_VALID_FLAGS_MASK \
++    (DMA_BUF_SYNC_RW | DMA_BUF_SYNC_END)
++#define DMA_BUF_BASE		'b'
++#define DMA_BUF_IOCTL_SYNC	_IOW(DMA_BUF_BASE, 0, struct dma_buf_sync)
++#endif
+ #include <sys/ioctl.h>
+ 
+ // Special Rockchip type
diff --git a/games/moonlight-qt/pkg-descr b/games/moonlight-qt/pkg-descr
new file mode 100644
index 000000000000..45af489a358a
--- /dev/null
+++ b/games/moonlight-qt/pkg-descr
@@ -0,0 +1,3 @@
+Moonlight PC is an open source PC client for NVIDIA GameStream and Sunshine. It
+allows you to stream your full collection of games from your Windows/Linux
+desktop to your FreeBSD system.