sunshine: 0.16.0 -> 0.18.4

This commit is contained in:
Morgan Helton 2023-02-26 19:17:12 -06:00
parent f9d19543b7
commit 34b27d45c1
5 changed files with 168 additions and 64 deletions

View file

@ -1,7 +1,10 @@
{ lib { lib
, stdenv , stdenv
, callPackage
, fetchFromGitHub , fetchFromGitHub
, fetchurl
, autoPatchelfHook , autoPatchelfHook
, makeWrapper
, buildNpmPackage , buildNpmPackage
, cmake , cmake
, avahi , avahi
@ -11,7 +14,7 @@
, libxcb , libxcb
, openssl , openssl
, libopus , libopus
, ffmpeg-full , ffmpeg_5-full
, boost , boost
, pkg-config , pkg-config
, libdrm , libdrm
@ -23,19 +26,29 @@
, libva , libva
, libvdpau , libvdpau
, numactl , numactl
, amf-headers
, svt-av1
, vulkan-loader
, cudaSupport ? false , cudaSupport ? false
, cudaPackages ? {} , cudaPackages ? {}
}: }:
let
libcbs = callPackage ./libcbs.nix { };
# get cmake file used to find external ffmpeg from previous sunshine version
findFfmpeg = fetchurl {
url = "https://raw.githubusercontent.com/LizardByte/Sunshine/6702802829869547708dfec98db5b8cbef39be89/cmake/FindFFMPEG.cmake";
sha256 = "sha256:1hl3sffv1z8ghdql5y9flk41v74asvh23y6jmaypll84f1s6k1xa";
};
in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "sunshine"; pname = "sunshine";
version = "0.16.0"; version = "0.18.4";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "LizardByte"; owner = "LizardByte";
repo = "Sunshine"; repo = "Sunshine";
rev = "v${version}"; rev = "v${version}";
sha256 = "sha256-o489IPza1iLoe74Onn2grP5oeNy0ZYdrvBoMEWlbwCE="; sha256 = "sha256-nPUWBka/fl1oTB0vTv6qyL7EHh7ptFnxwfV/jYtloTc=";
fetchSubmodules = true; fetchSubmodules = true;
}; };
@ -46,8 +59,7 @@ stdenv.mkDerivation rec {
ui = buildNpmPackage { ui = buildNpmPackage {
inherit src version; inherit src version;
pname = "sunshine-ui"; pname = "sunshine-ui";
sourceRoot = "source/src_assets/common/assets/web"; npmDepsHash = "sha256-k8Vfi/57AbGxYFPYSNh8bv4KqHnZjk3BDp8SJQHzuR8=";
npmDepsHash = "sha256-fg/turcpPMHUs6GBwSoJl4Pxua/lGfCA1RzT1R5q53M=";
dontNpmBuild = true; dontNpmBuild = true;
@ -66,13 +78,15 @@ stdenv.mkDerivation rec {
cmake cmake
pkg-config pkg-config
autoPatchelfHook autoPatchelfHook
makeWrapper
] ++ lib.optionals cudaSupport [ ] ++ lib.optionals cudaSupport [
cudaPackages.autoAddOpenGLRunpathHook cudaPackages.autoAddOpenGLRunpathHook
]; ];
buildInputs = [ buildInputs = [
libcbs
avahi avahi
ffmpeg-full ffmpeg_5-full
libevdev libevdev
libpulseaudio libpulseaudio
xorg.libX11 xorg.libX11
@ -94,6 +108,8 @@ stdenv.mkDerivation rec {
libvdpau libvdpau
numactl numactl
mesa mesa
amf-headers
svt-av1
] ++ lib.optionals cudaSupport [ ] ++ lib.optionals cudaSupport [
cudaPackages.cudatoolkit cudaPackages.cudatoolkit
]; ];
@ -117,16 +133,24 @@ stdenv.mkDerivation rec {
]; ];
postPatch = '' postPatch = ''
# Don't force the need for a static boost, fix hardcoded libevdev path # fix hardcoded libevdev path
substituteInPlace CMakeLists.txt \ 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' --replace '/usr/include/libevdev-1.0' '${libevdev}/include/libevdev-1.0'
# add FindFFMPEG to source tree
cp ${findFfmpeg} cmake/FindFFMPEG.cmake
''; '';
preBuild = '' preBuild = ''
# copy node_modules where they can be picked up by build # copy node_modules where they can be picked up by build
mkdir -p ../src_assets/common/assets/web/node_modules mkdir -p ../node_modules
cp -r ${ui}/node_modules/* ../src_assets/common/assets/web/node_modules cp -r ${ui}/node_modules/* ../node_modules
'';
# allow Sunshine to find libvulkan
postFixup = lib.optionalString cudaSupport ''
wrapProgram $out/bin/sunshine \
--set LD_LIBRARY_PATH ${lib.makeLibraryPath [ vulkan-loader ]}
''; '';
meta = with lib; { meta = with lib; {

View file

@ -1,49 +1,73 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt
index fad60ef..64b68ae 100644 index 1842c67..8afd0e9 100644
--- a/CMakeLists.txt --- a/CMakeLists.txt
+++ b/CMakeLists.txt +++ b/CMakeLists.txt
@@ -212,6 +212,8 @@ else() @@ -280,6 +280,8 @@ else()
set(WAYLAND_FOUND OFF) set(WAYLAND_FOUND OFF)
endif() endif()
+ find_package(FFMPEG REQUIRED) + find_package(FFMPEG REQUIRED)
+ +
if(X11_FOUND) if(X11_FOUND)
add_compile_definitions(SUNSHINE_BUILD_X11) add_compile_definitions(SUNSHINE_BUILD_X11)
include_directories(${X11_INCLUDE_DIR}) include_directories(${X11_INCLUDE_DIR})
@@ -372,35 +374,6 @@ set(SUNSHINE_TARGET_FILES @@ -451,51 +453,12 @@ set_source_files_properties(src/upnp.cpp PROPERTIES COMPILE_FLAGS -Wno-pedantic)
set_source_files_properties(third-party/nanors/rs.c
set_source_files_properties(src/upnp.cpp PROPERTIES COMPILE_FLAGS -Wno-pedantic) PROPERTIES COMPILE_FLAGS "-include deps/obl/autoshim.h -ftree-vectorize")
-# Pre-compiled binaries -# Pre-compiled binaries
-if(WIN32) -if(WIN32)
- set(FFMPEG_PREPARED_BINARIES "${CMAKE_CURRENT_SOURCE_DIR}/third-party/ffmpeg-windows-x86_64") - set(FFMPEG_PREPARED_BINARIES "${CMAKE_CURRENT_SOURCE_DIR}/third-party/ffmpeg-windows-x86_64")
- set(FFMPEG_PLATFORM_LIBRARIES mfplat ole32 strmiids mfuuid) - set(FFMPEG_PLATFORM_LIBRARIES mfplat ole32 strmiids mfuuid mfx)
-elseif(APPLE) -elseif(APPLE)
- set(FFMPEG_PREPARED_BINARIES "${CMAKE_CURRENT_SOURCE_DIR}/third-party/ffmpeg-macos-x86_64") - if (CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")
- set(FFMPEG_PREPARED_BINARIES "${CMAKE_CURRENT_SOURCE_DIR}/third-party/ffmpeg-macos-aarch64")
- else()
- set(FFMPEG_PREPARED_BINARIES "${CMAKE_CURRENT_SOURCE_DIR}/third-party/ffmpeg-macos-x86_64")
- endif()
-else() -else()
- if (CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64") - set(FFMPEG_PLATFORM_LIBRARIES va va-drm va-x11 vdpau X11)
- set(FFMPEG_PREPARED_BINARIES "${CMAKE_CURRENT_SOURCE_DIR}/third-party/ffmpeg-linux-aarch64") - if (CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
- else() - set(FFMPEG_PREPARED_BINARIES "${CMAKE_CURRENT_SOURCE_DIR}/third-party/ffmpeg-linux-aarch64")
- set(FFMPEG_PREPARED_BINARIES "${CMAKE_CURRENT_SOURCE_DIR}/third-party/ffmpeg-linux-x86_64") - else()
- endif() - set(FFMPEG_PREPARED_BINARIES "${CMAKE_CURRENT_SOURCE_DIR}/third-party/ffmpeg-linux-x86_64")
- set(FFMPEG_PLATFORM_LIBRARIES va va-drm va-x11 vdpau X11) - list(APPEND FFMPEG_PLATFORM_LIBRARIES mfx)
- set(CPACK_DEB_PLATFORM_PACKAGE_DEPENDS "libmfx1,")
- set(CPACK_RPM_PLATFORM_PACKAGE_REQUIRES "intel-mediasdk >= 22.3.0,")
- endif()
-endif() -endif()
-set(FFMPEG_INCLUDE_DIRS -set(FFMPEG_INCLUDE_DIRS
- ${FFMPEG_PREPARED_BINARIES}/include) - ${FFMPEG_PREPARED_BINARIES}/include)
-if(EXISTS ${FFMPEG_PREPARED_BINARIES}/lib/libhdr10plus.a) -if(EXISTS ${FFMPEG_PREPARED_BINARIES}/lib/libhdr10plus.a)
- set(HDR10_PLUS_LIBRARY - set(HDR10_PLUS_LIBRARY
- ${FFMPEG_PREPARED_BINARIES}/lib/libhdr10plus.a) - ${FFMPEG_PREPARED_BINARIES}/lib/libhdr10plus.a)
-endif() -endif()
-set(FFMPEG_LIBRARIES -set(FFMPEG_LIBRARIES
- ${FFMPEG_PREPARED_BINARIES}/lib/libavcodec.a - ${FFMPEG_PREPARED_BINARIES}/lib/libavcodec.a
- ${FFMPEG_PREPARED_BINARIES}/lib/libavutil.a - ${FFMPEG_PREPARED_BINARIES}/lib/libavutil.a
- ${FFMPEG_PREPARED_BINARIES}/lib/libswscale.a - ${FFMPEG_PREPARED_BINARIES}/lib/libcbs.a
- ${FFMPEG_PREPARED_BINARIES}/lib/libx264.a - ${FFMPEG_PREPARED_BINARIES}/lib/libSvtAv1Enc.a
- ${FFMPEG_PREPARED_BINARIES}/lib/libx265.a - ${FFMPEG_PREPARED_BINARIES}/lib/libswscale.a
- ${HDR10_PLUS_LIBRARY} - ${FFMPEG_PREPARED_BINARIES}/lib/libx264.a
- ${FFMPEG_PLATFORM_LIBRARIES}) - ${FFMPEG_PREPARED_BINARIES}/lib/libx265.a
- ${HDR10_PLUS_LIBRARY}
- ${FFMPEG_PLATFORM_LIBRARIES})
- -
include_directories( include_directories(
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/third-party ${CMAKE_CURRENT_SOURCE_DIR}/third-party
${CMAKE_CURRENT_SOURCE_DIR}/third-party/moonlight-common-c/enet/include
${CMAKE_CURRENT_SOURCE_DIR}/third-party/nanors
${CMAKE_CURRENT_SOURCE_DIR}/third-party/nanors/deps/obl
- ${FFMPEG_INCLUDE_DIRS}
${PLATFORM_INCLUDE_DIRS}
)
@@ -529,6 +492,7 @@ list(APPEND SUNSHINE_EXTERNAL_LIBRARIES
${CMAKE_THREAD_LIBS_INIT}
enet
opus
+ cbs
${FFMPEG_LIBRARIES}
${Boost_LIBRARIES}
${OPENSSL_LIBRARIES}

View file

@ -0,0 +1,48 @@
{ stdenv
, fetchFromGitHub
, cmake
, nasm
}:
stdenv.mkDerivation {
pname = "libcbs";
version = "unstable-2022-02-07";
src = fetchFromGitHub {
owner = "LizardByte";
repo = "build-deps";
# repo is not versioned -- used latest commit combined with sunshine release
rev = "d6e889188ca10118d769ee1ee3cddf9cf485642b";
fetchSubmodules = true;
sha256 = "sha256-6xQDJey5JrZXyZxS/yhUBvFi6UD5MsQ3uVtUFrG09Vc=";
};
nativeBuildInputs = [
cmake
nasm
];
# modify paths to allow patches to be applied directly by derivation
prePatch = ''
substituteInPlace ffmpeg_patches/cbs/* \
--replace 'a/libavcodec' 'a/ffmpeg_sources/ffmpeg/libavcodec' \
--replace 'b/libavcodec' 'b/ffmpeg_sources/ffmpeg/libavcodec' \
--replace 'a/libavutil' 'a/ffmpeg_sources/ffmpeg/libavutil' \
--replace 'b/libavutil' 'b/ffmpeg_sources/ffmpeg/libavutil'
substituteInPlace cmake/ffmpeg_cbs.cmake \
--replace '--enable-static' '--enable-shared --enable-pic' \
--replace 'add_library(cbs' 'add_library(cbs SHARED' \
--replace 'libcbs.a' 'libcbs.so'
'';
patches = [
"ffmpeg_patches/cbs/01-explicit-intmath.patch"
"ffmpeg_patches/cbs/02-include-cbs-config.patch"
"ffmpeg_patches/cbs/03-remove-register.patch"
"ffmpeg_patches/cbs/04-size-specifier.patch"
];
CFLAGS = [
"-Wno-format-security"
];
}

View file

@ -1,19 +1,19 @@
{ {
"name": "web", "name": "Sunshine",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"dependencies": { "dependencies": {
"@fortawesome/fontawesome-free": "6.2.0", "@fortawesome/fontawesome-free": "6.2.1",
"bootstrap": "5.0.0", "bootstrap": "5.2.3",
"vue": "2.6.12" "vue": "2.6.12"
} }
}, },
"node_modules/@fortawesome/fontawesome-free": { "node_modules/@fortawesome/fontawesome-free": {
"version": "6.2.0", "version": "6.2.1",
"resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-6.2.0.tgz", "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-6.2.1.tgz",
"integrity": "sha512-CNR7qRIfCwWHNN7FnKUniva94edPdyQzil/zCwk3v6k4R6rR2Fr8i4s3PM7n/lyfPA6Zfko9z5WDzFxG9SW1uQ==", "integrity": "sha512-viouXhegu/TjkvYQoiRZK3aax69dGXxgEjpvZW81wIJdxm5Fnvp3VVIP4VHKqX4SvFw6qpmkILkD4RJWAdrt7A==",
"hasInstallScript": true, "hasInstallScript": true,
"engines": { "engines": {
"node": ">=6" "node": ">=6"
@ -30,15 +30,21 @@
} }
}, },
"node_modules/bootstrap": { "node_modules/bootstrap": {
"version": "5.0.0", "version": "5.2.3",
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.0.0.tgz", "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.2.3.tgz",
"integrity": "sha512-tmhPET9B9qCl8dCofvHeiIhi49iBt0EehmIsziZib65k1erBW1rHhj2s/2JsuQh5Pq+xz2E9bEbzp9B7xHG+VA==", "integrity": "sha512-cEKPM+fwb3cT8NzQZYEu4HilJ3anCrWqh3CHAok1p9jXqMPsPTBhU25fBckEJHJ/p+tTxTFTsFQGM+gaHpi3QQ==",
"funding": { "funding": [
"type": "opencollective", {
"url": "https://opencollective.com/bootstrap" "type": "github",
}, "url": "https://github.com/sponsors/twbs"
},
{
"type": "opencollective",
"url": "https://opencollective.com/bootstrap"
}
],
"peerDependencies": { "peerDependencies": {
"@popperjs/core": "^2.9.2" "@popperjs/core": "^2.11.6"
} }
}, },
"node_modules/vue": { "node_modules/vue": {
@ -49,9 +55,9 @@
}, },
"dependencies": { "dependencies": {
"@fortawesome/fontawesome-free": { "@fortawesome/fontawesome-free": {
"version": "6.2.0", "version": "6.2.1",
"resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-6.2.0.tgz", "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-6.2.1.tgz",
"integrity": "sha512-CNR7qRIfCwWHNN7FnKUniva94edPdyQzil/zCwk3v6k4R6rR2Fr8i4s3PM7n/lyfPA6Zfko9z5WDzFxG9SW1uQ==" "integrity": "sha512-viouXhegu/TjkvYQoiRZK3aax69dGXxgEjpvZW81wIJdxm5Fnvp3VVIP4VHKqX4SvFw6qpmkILkD4RJWAdrt7A=="
}, },
"@popperjs/core": { "@popperjs/core": {
"version": "2.11.6", "version": "2.11.6",
@ -60,9 +66,9 @@
"peer": true "peer": true
}, },
"bootstrap": { "bootstrap": {
"version": "5.0.0", "version": "5.2.3",
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.0.0.tgz", "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.2.3.tgz",
"integrity": "sha512-tmhPET9B9qCl8dCofvHeiIhi49iBt0EehmIsziZib65k1erBW1rHhj2s/2JsuQh5Pq+xz2E9bEbzp9B7xHG+VA==", "integrity": "sha512-cEKPM+fwb3cT8NzQZYEu4HilJ3anCrWqh3CHAok1p9jXqMPsPTBhU25fBckEJHJ/p+tTxTFTsFQGM+gaHpi3QQ==",
"requires": {} "requires": {}
}, },
"vue": { "vue": {

View file

@ -39398,7 +39398,9 @@ with pkgs;
stayrtr = callPackage ../servers/stayrtr { }; stayrtr = callPackage ../servers/stayrtr { };
sunshine = callPackage ../servers/sunshine { }; sunshine = callPackage ../servers/sunshine {
ffmpeg_5-full = ffmpeg_5-full.override { nv-codec-headers = nv-codec-headers-11; };
};
sentencepiece = callPackage ../development/libraries/sentencepiece { }; sentencepiece = callPackage ../development/libraries/sentencepiece { };