Merge pull request #214799 from devusb/sunshine
This commit is contained in:
commit
07bfc8e6c5
26
pkgs/development/libraries/amf-headers/default.nix
Normal file
26
pkgs/development/libraries/amf-headers/default.nix
Normal file
|
@ -0,0 +1,26 @@
|
|||
{ lib, stdenv, fetchFromGitHub }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "amf-headers";
|
||||
version = "1.4.29";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "GPUOpen-LibrariesAndSDKs";
|
||||
repo = "AMF";
|
||||
rev = "v${version}";
|
||||
sha256 = "sha256-gu8plGUUVE/De2bRjTUN8JKsmj/0r/IsqhMpln1DZGU=";
|
||||
};
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/include/AMF
|
||||
cp -r amf/public/include/* $out/include/AMF
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "Headers for The Advanced Media Framework (AMF)";
|
||||
homepage = "https://github.com/GPUOpen-LibrariesAndSDKs/AMF";
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ devusb ];
|
||||
platforms = platforms.unix;
|
||||
};
|
||||
}
|
|
@ -1,7 +1,10 @@
|
|||
{ lib
|
||||
, stdenv
|
||||
, callPackage
|
||||
, fetchFromGitHub
|
||||
, fetchurl
|
||||
, autoPatchelfHook
|
||||
, makeWrapper
|
||||
, buildNpmPackage
|
||||
, cmake
|
||||
, avahi
|
||||
|
@ -11,7 +14,7 @@
|
|||
, libxcb
|
||||
, openssl
|
||||
, libopus
|
||||
, ffmpeg-full
|
||||
, ffmpeg_5-full
|
||||
, boost
|
||||
, pkg-config
|
||||
, libdrm
|
||||
|
@ -23,19 +26,29 @@
|
|||
, libva
|
||||
, libvdpau
|
||||
, numactl
|
||||
, amf-headers
|
||||
, svt-av1
|
||||
, vulkan-loader
|
||||
, cudaSupport ? false
|
||||
, 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 {
|
||||
pname = "sunshine";
|
||||
version = "0.16.0";
|
||||
version = "0.18.4";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "LizardByte";
|
||||
repo = "Sunshine";
|
||||
rev = "v${version}";
|
||||
sha256 = "sha256-o489IPza1iLoe74Onn2grP5oeNy0ZYdrvBoMEWlbwCE=";
|
||||
sha256 = "sha256-nPUWBka/fl1oTB0vTv6qyL7EHh7ptFnxwfV/jYtloTc=";
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
|
||||
|
@ -46,8 +59,7 @@ stdenv.mkDerivation rec {
|
|||
ui = buildNpmPackage {
|
||||
inherit src version;
|
||||
pname = "sunshine-ui";
|
||||
sourceRoot = "source/src_assets/common/assets/web";
|
||||
npmDepsHash = "sha256-fg/turcpPMHUs6GBwSoJl4Pxua/lGfCA1RzT1R5q53M=";
|
||||
npmDepsHash = "sha256-k8Vfi/57AbGxYFPYSNh8bv4KqHnZjk3BDp8SJQHzuR8=";
|
||||
|
||||
dontNpmBuild = true;
|
||||
|
||||
|
@ -66,13 +78,15 @@ stdenv.mkDerivation rec {
|
|||
cmake
|
||||
pkg-config
|
||||
autoPatchelfHook
|
||||
makeWrapper
|
||||
] ++ lib.optionals cudaSupport [
|
||||
cudaPackages.autoAddOpenGLRunpathHook
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
libcbs
|
||||
avahi
|
||||
ffmpeg-full
|
||||
ffmpeg_5-full
|
||||
libevdev
|
||||
libpulseaudio
|
||||
xorg.libX11
|
||||
|
@ -94,6 +108,8 @@ stdenv.mkDerivation rec {
|
|||
libvdpau
|
||||
numactl
|
||||
mesa
|
||||
amf-headers
|
||||
svt-av1
|
||||
] ++ lib.optionals cudaSupport [
|
||||
cudaPackages.cudatoolkit
|
||||
];
|
||||
|
@ -117,16 +133,24 @@ stdenv.mkDerivation rec {
|
|||
];
|
||||
|
||||
postPatch = ''
|
||||
# Don't force the need for a static boost, fix hardcoded libevdev path
|
||||
# fix hardcoded libevdev path
|
||||
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'
|
||||
|
||||
# add FindFFMPEG to source tree
|
||||
cp ${findFfmpeg} cmake/FindFFMPEG.cmake
|
||||
'';
|
||||
|
||||
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
|
||||
mkdir -p ../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; {
|
||||
|
|
|
@ -1,49 +1,73 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index fad60ef..64b68ae 100644
|
||||
index 1842c67..8afd0e9 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -212,6 +212,8 @@ else()
|
||||
set(WAYLAND_FOUND OFF)
|
||||
endif()
|
||||
@@ -280,6 +280,8 @@ else()
|
||||
set(WAYLAND_FOUND OFF)
|
||||
endif()
|
||||
|
||||
+ find_package(FFMPEG REQUIRED)
|
||||
+ 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)
|
||||
if(X11_FOUND)
|
||||
add_compile_definitions(SUNSHINE_BUILD_X11)
|
||||
include_directories(${X11_INCLUDE_DIR})
|
||||
@@ -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
|
||||
PROPERTIES COMPILE_FLAGS "-include deps/obl/autoshim.h -ftree-vectorize")
|
||||
|
||||
-# 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)
|
||||
- set(FFMPEG_PREPARED_BINARIES "${CMAKE_CURRENT_SOURCE_DIR}/third-party/ffmpeg-windows-x86_64")
|
||||
- set(FFMPEG_PLATFORM_LIBRARIES mfplat ole32 strmiids mfuuid mfx)
|
||||
-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()
|
||||
- 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)
|
||||
- set(FFMPEG_PLATFORM_LIBRARIES va va-drm va-x11 vdpau X11)
|
||||
- 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")
|
||||
- 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()
|
||||
-set(FFMPEG_INCLUDE_DIRS
|
||||
- ${FFMPEG_PREPARED_BINARIES}/include)
|
||||
- ${FFMPEG_PREPARED_BINARIES}/include)
|
||||
-if(EXISTS ${FFMPEG_PREPARED_BINARIES}/lib/libhdr10plus.a)
|
||||
- set(HDR10_PLUS_LIBRARY
|
||||
- ${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})
|
||||
- ${FFMPEG_PREPARED_BINARIES}/lib/libavcodec.a
|
||||
- ${FFMPEG_PREPARED_BINARIES}/lib/libavutil.a
|
||||
- ${FFMPEG_PREPARED_BINARIES}/lib/libcbs.a
|
||||
- ${FFMPEG_PREPARED_BINARIES}/lib/libSvtAv1Enc.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
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${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}
|
||||
|
|
48
pkgs/servers/sunshine/libcbs.nix
Normal file
48
pkgs/servers/sunshine/libcbs.nix
Normal 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"
|
||||
];
|
||||
}
|
46
pkgs/servers/sunshine/package-lock.json
generated
46
pkgs/servers/sunshine/package-lock.json
generated
|
@ -1,19 +1,19 @@
|
|||
{
|
||||
"name": "web",
|
||||
"name": "Sunshine",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"dependencies": {
|
||||
"@fortawesome/fontawesome-free": "6.2.0",
|
||||
"bootstrap": "5.0.0",
|
||||
"@fortawesome/fontawesome-free": "6.2.1",
|
||||
"bootstrap": "5.2.3",
|
||||
"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==",
|
||||
"version": "6.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-6.2.1.tgz",
|
||||
"integrity": "sha512-viouXhegu/TjkvYQoiRZK3aax69dGXxgEjpvZW81wIJdxm5Fnvp3VVIP4VHKqX4SvFw6qpmkILkD4RJWAdrt7A==",
|
||||
"hasInstallScript": true,
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
|
@ -30,15 +30,21 @@
|
|||
}
|
||||
},
|
||||
"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"
|
||||
},
|
||||
"version": "5.2.3",
|
||||
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.2.3.tgz",
|
||||
"integrity": "sha512-cEKPM+fwb3cT8NzQZYEu4HilJ3anCrWqh3CHAok1p9jXqMPsPTBhU25fBckEJHJ/p+tTxTFTsFQGM+gaHpi3QQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/twbs"
|
||||
},
|
||||
{
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/bootstrap"
|
||||
}
|
||||
],
|
||||
"peerDependencies": {
|
||||
"@popperjs/core": "^2.9.2"
|
||||
"@popperjs/core": "^2.11.6"
|
||||
}
|
||||
},
|
||||
"node_modules/vue": {
|
||||
|
@ -49,9 +55,9 @@
|
|||
},
|
||||
"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=="
|
||||
"version": "6.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-6.2.1.tgz",
|
||||
"integrity": "sha512-viouXhegu/TjkvYQoiRZK3aax69dGXxgEjpvZW81wIJdxm5Fnvp3VVIP4VHKqX4SvFw6qpmkILkD4RJWAdrt7A=="
|
||||
},
|
||||
"@popperjs/core": {
|
||||
"version": "2.11.6",
|
||||
|
@ -60,9 +66,9 @@
|
|||
"peer": true
|
||||
},
|
||||
"bootstrap": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.0.0.tgz",
|
||||
"integrity": "sha512-tmhPET9B9qCl8dCofvHeiIhi49iBt0EehmIsziZib65k1erBW1rHhj2s/2JsuQh5Pq+xz2E9bEbzp9B7xHG+VA==",
|
||||
"version": "5.2.3",
|
||||
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.2.3.tgz",
|
||||
"integrity": "sha512-cEKPM+fwb3cT8NzQZYEu4HilJ3anCrWqh3CHAok1p9jXqMPsPTBhU25fBckEJHJ/p+tTxTFTsFQGM+gaHpi3QQ==",
|
||||
"requires": {}
|
||||
},
|
||||
"vue": {
|
||||
|
|
|
@ -19165,6 +19165,8 @@ with pkgs;
|
|||
|
||||
amdvlk = callPackage ../development/libraries/amdvlk { };
|
||||
|
||||
amf-headers = callPackage ../development/libraries/amf-headers { };
|
||||
|
||||
aml = callPackage ../development/libraries/aml { };
|
||||
|
||||
amrnb = callPackage ../development/libraries/amrnb { };
|
||||
|
@ -39420,7 +39422,9 @@ with pkgs;
|
|||
|
||||
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 { };
|
||||
|
||||
|
|
Loading…
Reference in a new issue