Skip to content

Commit

Permalink
games/moonlight-qt: Open source PC client for NVIDIA GameStream and S…
Browse files Browse the repository at this point in the history
…unshine

Differential Revision: https://reviews.freebsd.org/D42323
  • Loading branch information
arrowd committed Oct 23, 2023
1 parent 44997e6 commit 462adef
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 0 deletions.
45 changes: 45 additions & 0 deletions 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>
3 changes: 3 additions & 0 deletions 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
@@ -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
3 changes: 3 additions & 0 deletions 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.

0 comments on commit 462adef

Please sign in to comment.