sunshine: 0.15.0 -> 0.16.0

This commit is contained in:
Morgan Helton 2022-12-21 18:17:52 -06:00
parent 5d6fa6fdeb
commit ece23c36df
3 changed files with 173 additions and 23 deletions

View File

@ -1,6 +1,8 @@
{ lib
, stdenv
, fetchFromGitHub
, autoPatchelfHook
, buildNpmPackage
, cmake
, avahi
, libevdev
@ -17,25 +19,53 @@
, libffi
, libcap
, mesa
, curl
, libva
, libvdpau
, numactl
, cudaSupport ? false
, cudaPackages ? {}
}:
stdenv.mkDerivation rec {
pname = "sunshine";
version = "0.15.0";
version = "0.16.0";
src = fetchFromGitHub {
owner = "LizardByte";
repo = "Sunshine";
rev = "v${version}";
sha256 = "sha256-/eekvpjopCivb2FJqh5W1G54GznLwdjk8ANOosdfuxw=";
sha256 = "sha256-o489IPza1iLoe74Onn2grP5oeNy0ZYdrvBoMEWlbwCE=";
fetchSubmodules = true;
};
# remove pre-built ffmpeg; use ffmpeg from nixpkgs
patches = [ ./ffmpeg.diff ];
# fetch node_modules needed for webui
ui = buildNpmPackage {
inherit src version;
pname = "sunshine-ui";
sourceRoot = "source/src_assets/common/assets/web";
npmDepsHash = "sha256-fg/turcpPMHUs6GBwSoJl4Pxua/lGfCA1RzT1R5q53M=";
dontNpmBuild = true;
# use generated package-lock.json upstream does not provide one
postPatch = ''
cp ${./package-lock.json} ./package-lock.json
'';
installPhase = ''
mkdir -p $out
cp -r node_modules $out/
'';
};
nativeBuildInputs = [
cmake
pkg-config
autoPatchelfHook
] ++ lib.optionals cudaSupport [
cudaPackages.autoAddOpenGLRunpathHook
];
@ -59,11 +89,22 @@ stdenv.mkDerivation rec {
libevdev
libcap
libdrm
curl
libva
libvdpau
numactl
mesa
] ++ lib.optionals cudaSupport [
cudaPackages.cudatoolkit
];
runtimeDependencies = [
avahi
mesa
xorg.libXrandr
libxcb
];
CXXFLAGS = [
"-Wno-format-security"
];
@ -72,18 +113,7 @@ stdenv.mkDerivation rec {
];
cmakeFlags = [
"-D" "FFMPEG_LIBRARIES=${ffmpeg-full}/lib"
"-D" "FFMPEG_INCLUDE_DIRS=${ffmpeg-full}/include"
"-D" "LIBAVCODEC_INCLUDE_DIR=${ffmpeg-full}/include"
"-D" "LIBAVCODEC_LIBRARIES=${ffmpeg-full}/lib/libavcodec.so"
"-D" "LIBAVDEVICE_INCLUDE_DIR=${ffmpeg-full}/include"
"-D" "LIBAVDEVICE_LIBRARIES=${ffmpeg-full}/lib/libavdevice.so"
"-D" "LIBAVFORMAT_INCLUDE_DIR=${ffmpeg-full}/include"
"-D" "LIBAVFORMAT_LIBRARIES=${ffmpeg-full}/lib/libavformat.so"
"-D" "LIBAVUTIL_INCLUDE_DIR=${ffmpeg-full}/include"
"-D" "LIBAVUTIL_LIBRARIES=${ffmpeg-full}/lib/libavutil.so"
"-D" "LIBSWSCALE_LIBRARIES=${ffmpeg-full}/lib/libswscale.so"
"-D" "LIBSWSCALE_INCLUDE_DIR=${ffmpeg-full}/include"
"-Wno-dev"
];
postPatch = ''
@ -91,20 +121,17 @@ stdenv.mkDerivation rec {
substituteInPlace CMakeLists.txt \
--replace 'set(Boost_USE_STATIC_LIBS ON)' '# set(Boost_USE_STATIC_LIBS ON)' \
--replace '/usr/include/libevdev-1.0' '${libevdev}/include/libevdev-1.0'
'';
# fix libgbm path
substituteInPlace src/platform/linux/graphics.cpp \
--replace 'handle = dyn::handle({ "libgbm.so.1", "libgbm.so" });' 'handle = dyn::handle({ "${mesa}/lib/libgbm.so.1", "${mesa}/lib/libgbm.so" });'
# fix avahi path
substituteInPlace src/platform/linux/publish.cpp \
--replace 'handle = dyn::handle({ "libavahi-client.so.3", "libavahi-client.so" });' 'handle = dyn::handle({ "${avahi}/lib/libavahi-client.so.3", "${avahi}/lib/libavahi-client.so" });' \
--replace 'handle = dyn::handle({ "libavahi-common.so.3", "libavahi-common.so" });' 'handle = dyn::handle({ "${avahi}/lib/libavahi-common.so.3", "${avahi}/lib/libavahi-common.so" });'
preBuild = ''
# copy node_modules where they can be picked up by build
mkdir -p ../src_assets/common/assets/web/node_modules
cp -r ${ui}/node_modules/* ../src_assets/common/assets/web/node_modules
'';
meta = with lib; {
description = "Sunshine is a Game stream host for Moonlight.";
homepage = "https://docs.lizardbyte.dev/projects/sunshine/";
homepage = "https://github.com/LizardByte/Sunshine";
license = licenses.gpl3Only;
maintainers = with maintainers; [ devusb ];
platforms = platforms.linux;

View File

@ -0,0 +1,49 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fad60ef..64b68ae 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -212,6 +212,8 @@ else()
set(WAYLAND_FOUND OFF)
endif()
+ find_package(FFMPEG REQUIRED)
+
if(X11_FOUND)
add_compile_definitions(SUNSHINE_BUILD_X11)
include_directories(${X11_INCLUDE_DIR})
@@ -372,35 +374,6 @@ set(SUNSHINE_TARGET_FILES
set_source_files_properties(src/upnp.cpp PROPERTIES COMPILE_FLAGS -Wno-pedantic)
-# Pre-compiled binaries
-if(WIN32)
- set(FFMPEG_PREPARED_BINARIES "${CMAKE_CURRENT_SOURCE_DIR}/third-party/ffmpeg-windows-x86_64")
- set(FFMPEG_PLATFORM_LIBRARIES mfplat ole32 strmiids mfuuid)
-elseif(APPLE)
- set(FFMPEG_PREPARED_BINARIES "${CMAKE_CURRENT_SOURCE_DIR}/third-party/ffmpeg-macos-x86_64")
-else()
- if (CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
- set(FFMPEG_PREPARED_BINARIES "${CMAKE_CURRENT_SOURCE_DIR}/third-party/ffmpeg-linux-aarch64")
- else()
- set(FFMPEG_PREPARED_BINARIES "${CMAKE_CURRENT_SOURCE_DIR}/third-party/ffmpeg-linux-x86_64")
- endif()
- set(FFMPEG_PLATFORM_LIBRARIES va va-drm va-x11 vdpau X11)
-endif()
-set(FFMPEG_INCLUDE_DIRS
- ${FFMPEG_PREPARED_BINARIES}/include)
-if(EXISTS ${FFMPEG_PREPARED_BINARIES}/lib/libhdr10plus.a)
- set(HDR10_PLUS_LIBRARY
- ${FFMPEG_PREPARED_BINARIES}/lib/libhdr10plus.a)
-endif()
-set(FFMPEG_LIBRARIES
- ${FFMPEG_PREPARED_BINARIES}/lib/libavcodec.a
- ${FFMPEG_PREPARED_BINARIES}/lib/libavutil.a
- ${FFMPEG_PREPARED_BINARIES}/lib/libswscale.a
- ${FFMPEG_PREPARED_BINARIES}/lib/libx264.a
- ${FFMPEG_PREPARED_BINARIES}/lib/libx265.a
- ${HDR10_PLUS_LIBRARY}
- ${FFMPEG_PLATFORM_LIBRARIES})
-
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/third-party

74
pkgs/servers/sunshine/package-lock.json generated Normal file
View File

@ -0,0 +1,74 @@
{
"name": "web",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"dependencies": {
"@fortawesome/fontawesome-free": "6.2.0",
"bootstrap": "5.0.0",
"vue": "2.6.12"
}
},
"node_modules/@fortawesome/fontawesome-free": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-6.2.0.tgz",
"integrity": "sha512-CNR7qRIfCwWHNN7FnKUniva94edPdyQzil/zCwk3v6k4R6rR2Fr8i4s3PM7n/lyfPA6Zfko9z5WDzFxG9SW1uQ==",
"hasInstallScript": true,
"engines": {
"node": ">=6"
}
},
"node_modules/@popperjs/core": {
"version": "2.11.6",
"resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.6.tgz",
"integrity": "sha512-50/17A98tWUfQ176raKiOGXuYpLyyVMkxxG6oylzL3BPOlA6ADGdK7EYunSa4I064xerltq9TGXs8HmOk5E+vw==",
"peer": true,
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/popperjs"
}
},
"node_modules/bootstrap": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.0.0.tgz",
"integrity": "sha512-tmhPET9B9qCl8dCofvHeiIhi49iBt0EehmIsziZib65k1erBW1rHhj2s/2JsuQh5Pq+xz2E9bEbzp9B7xHG+VA==",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/bootstrap"
},
"peerDependencies": {
"@popperjs/core": "^2.9.2"
}
},
"node_modules/vue": {
"version": "2.6.12",
"resolved": "https://registry.npmjs.org/vue/-/vue-2.6.12.tgz",
"integrity": "sha512-uhmLFETqPPNyuLLbsKz6ioJ4q7AZHzD8ZVFNATNyICSZouqP2Sz0rotWQC8UNBF6VGSCs5abnKJoStA6JbCbfg=="
}
},
"dependencies": {
"@fortawesome/fontawesome-free": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-6.2.0.tgz",
"integrity": "sha512-CNR7qRIfCwWHNN7FnKUniva94edPdyQzil/zCwk3v6k4R6rR2Fr8i4s3PM7n/lyfPA6Zfko9z5WDzFxG9SW1uQ=="
},
"@popperjs/core": {
"version": "2.11.6",
"resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.6.tgz",
"integrity": "sha512-50/17A98tWUfQ176raKiOGXuYpLyyVMkxxG6oylzL3BPOlA6ADGdK7EYunSa4I064xerltq9TGXs8HmOk5E+vw==",
"peer": true
},
"bootstrap": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.0.0.tgz",
"integrity": "sha512-tmhPET9B9qCl8dCofvHeiIhi49iBt0EehmIsziZib65k1erBW1rHhj2s/2JsuQh5Pq+xz2E9bEbzp9B7xHG+VA==",
"requires": {}
},
"vue": {
"version": "2.6.12",
"resolved": "https://registry.npmjs.org/vue/-/vue-2.6.12.tgz",
"integrity": "sha512-uhmLFETqPPNyuLLbsKz6ioJ4q7AZHzD8ZVFNATNyICSZouqP2Sz0rotWQC8UNBF6VGSCs5abnKJoStA6JbCbfg=="
}
}
}