summaryrefslogtreecommitdiff
path: root/multimedia/sunshine/Makefile
blob: 0eea40975431b47f9bc1fc2db58179f92c04992c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
PORTNAME=	sunshine
DISTVERSIONPREFIX=	v
DISTVERSION=	2026.516.143833
CATEGORIES=	multimedia

MAINTAINER=	cashmere@autistici.org
COMMENT=	Self-hosted game stream host for Moonlight
WWW=		https://app.lizardbyte.dev/Sunshine

LICENSE=	GPLv3
LICENSE_FILE=	${WRKSRC}/LICENSE

# Prebuilt FFmpeg static libraries published by LizardByte/build-deps
# (the same archive upstream's own FreeBSD package is linked against).
# Sunshine's cmake requires libcbs.a, which no FreeBSD port provides,
# so building against multimedia/ffmpeg is not an option.
FFMPEG_BDEP_TAG=	v2026.516.30821

FETCH_DEPENDS=	npm:www/npm
BUILD_DEPENDS=	npm:www/npm \
		boost-libs>=0:devel/boost-libs \
		glslc:graphics/shaderc \
		wayland-scanner:graphics/wayland \
		${PYTHON_PKGNAMEPREFIX}Jinja2>=0:devel/py-Jinja2 \
		${PYTHON_PKGNAMEPREFIX}setuptools>=0:devel/py-setuptools \
		${LOCALBASE}/include/linux/input.h:devel/evdev-proto \
		${LOCALBASE}/include/vulkan/vulkan.h:graphics/vulkan-headers \
		${LOCALBASE}/share/cmake/nlohmann_json/nlohmann_jsonConfig.cmake:devel/nlohmann-json \
		${LOCALBASE}/share/pkgconfig/wayland-protocols.pc:graphics/wayland-protocols
LIB_DEPENDS=	libatk-1.0.so:accessibility/at-spi2-core \
		libayatana-appindicator3.so:devel/libayatana-appindicator \
		libayatana-ido3-0.4.so:devel/ayatana-ido \
		libayatana-indicator3.so:devel/libayatana-indicator \
		libcurl.so:ftp/curl \
		libdbusmenu-glib.so:devel/libdbusmenu \
		libdrm.so:graphics/libdrm \
		libevdev.so:devel/libevdev \
		libgbm.so:graphics/mesa-libs \
		libharfbuzz.so:print/harfbuzz \
		libicui18n.so:devel/icu \
		libminiupnpc.so:net/miniupnpc \
		libnotify.so:devel/libnotify \
		libopus.so:audio/opus \
		libpipewire-0.3.so:multimedia/pipewire \
		libpulse.so:audio/pulseaudio \
		libva.so:multimedia/libva \
		libva-drm.so:multimedia/libva \
		libva-x11.so:multimedia/libva \
		libvulkan.so:graphics/vulkan-loader \
		libwayland-client.so:graphics/wayland

USES=		cmake gnome pkgconfig python:build ssl xorg
USE_GNOME=	cairo gdkpixbuf glib20 gtk30 pango
USE_XORG=	ice sm x11 xcb xext xfixes xrandr xtst

USE_GITHUB=	yes
GH_ACCOUNT=	LizardByte
GH_PROJECT=	Sunshine
GH_TUPLE=	LizardByte-infrastructure:Simple-Web-Server:546895a93a29062bb178367b46c7afb72da9881e:sws/third-party/Simple-Web-Server \
		moonlight-stream:moonlight-common-c:2600beaf13f18bfa43453609cf5e3b84a4227760:mlc/third-party/moonlight-common-c \
		cgutman:enet:c7353c059373f8d3fc83d451f8f1a477be3dc94e:enet/third-party/moonlight-common-c/enet \
		LizardByte:libdisplaydevice:fe7e6a81f65deae91594702e1a185f47229745b9:ldd/third-party/libdisplaydevice \
		Dav1dde:glad:73db193f853e2ee079bf3ca8a64aa2eaf6459043:glad/third-party/glad \
		games-on-whales:inputtino:f4ce2b0df536ef309e9ff318f75b460f7097d7c1:inputtino/third-party/inputtino \
		sleepybishop:nanors:19f07b513e924e471cadd141943c1ec4adc8d0e0:nanors/third-party/nanors \
		LizardByte:tray:563dee475f8878d252ab2b9938d3a014e776ed08:tray/third-party/tray \
		LizardByte-infrastructure:wlr-protocols:bf4fc79abc359eea5a0edec0ac6d4a2b2955f82a:wlr/third-party/wlr-protocols \
		KDE:plasma-wayland-protocols:4c015e90ae6c88f2ffa766e899387ef431eade49:pwp/third-party/plasma-wayland-protocols \
		FFmpeg:nv-codec-headers:33a9ede8d9914299d9262539c576a15bd0a19621:nvch/third-party/nv-codec-headers

MASTER_SITES+=	https://github.com/LizardByte/build-deps/releases/download/${FFMPEG_BDEP_TAG}/:ffmpeg_bin
DISTFILES+=	FreeBSD-amd64-ffmpeg.tar.gz:ffmpeg_bin \
		${WEB_DEPS_TARBALL}

INSTALLS_ICONS=	yes

# Node modules for the web UI, vendored in pre-fetch (the only phase with
# network access under poudriere).  files/patch-cmake_targets_common.cmake
# drops the "npm ci" step from the build so the vendored copy is used as-is.
WEB_DEPS_TARBALL=	${PORTNAME}-web-deps-${DISTVERSION}${EXTRACT_SUFX}
WEB_UI_URL=		https://raw.githubusercontent.com/${GH_ACCOUNT}/${GH_PROJECT}/${DISTVERSIONPREFIX}${DISTVERSION}

CMAKE_ARGS=	-DBUILD_DOCS=OFF \
		-DBUILD_TESTS=OFF \
		-DBUILD_WERROR=OFF \
		-DFFMPEG_PREPARED_BINARIES=${WRKDIR}/ffmpeg \
		-DGLAD_SKIP_PIP_INSTALL=ON \
		-DOPUS_USE_STATIC=OFF \
		-DPython_EXECUTABLE=${PYTHON_CMD} \
		-DSUNSHINE_ASSETS_DIR=share/assets \
		-DSUNSHINE_ENABLE_CUDA=OFF \
		-DSUNSHINE_ENABLE_DRM=OFF \
		-DSUNSHINE_ENABLE_KWIN=ON \
		-DSUNSHINE_ENABLE_PORTAL=ON \
		-DSUNSHINE_ENABLE_VAAPI=ON \
		-DSUNSHINE_ENABLE_VULKAN=ON \
		-DSUNSHINE_ENABLE_WAYLAND=ON \
		-DSUNSHINE_ENABLE_X11=ON \
		-DSUNSHINE_EXECUTABLE_PATH=${PREFIX}/bin/sunshine \
		-DSUNSHINE_PUBLISHER_NAME=FreeBSD \
		-DSUNSHINE_PUBLISHER_WEBSITE=https://app.lizardbyte.dev \
		-DSUNSHINE_PUBLISHER_ISSUE_URL=https://app.lizardbyte.dev/support \
		-DSUNSHINE_SYSTEM_VULKAN_HEADERS=ON \
		-DSUNSHINE_SYSTEM_WAYLAND_PROTOCOLS=ON

# Version is normally derived from git; the distfile is not a checkout.
CONFIGURE_ENV=	BRANCH=master \
		BUILD_VERSION=${DISTVERSIONPREFIX}${DISTVERSION}

pre-fetch:
	@if ! [ -f ${DISTDIR}/${WEB_DEPS_TARBALL} ]; then ( \
		${RM} -rf ${WRKDIR}/web-deps && \
		${MKDIR} ${WRKDIR}/web-deps && \
		cd ${WRKDIR}/web-deps && \
		${FETCH_CMD} -o package.json ${WEB_UI_URL}/package.json && \
		${FETCH_CMD} -o package-lock.json ${WEB_UI_URL}/package-lock.json && \
		${SETENV} HOME=${WRKDIR}/web-deps npm ci --ignore-scripts && \
		${FIND} node_modules -exec ${TOUCH} -h -d 1970-01-01T00:00:00Z {} \; && \
		${FIND} node_modules -print0 | ${SORT} -z | \
			${TAR} czf ${DISTDIR}/${WEB_DEPS_TARBALL} --format=bsdtar --gid 0 --uid 0 \
			--options gzip:!timestamp --no-recursion --null -T - && \
		${RM} -rf ${WRKDIR}/web-deps \
	); fi

post-extract:
	@${MV} ${WRKDIR}/node_modules ${WRKSRC}/node_modules

.include <bsd.port.mk>