Merge pull request #262591 from devusb/sunshine-update

sunshine: 0.20.0 -> 0.21.0
This commit is contained in:
Peder Bergebakken Sundt 2023-10-26 16:14:58 +02:00 committed by GitHub
commit 0de727d6a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 43 additions and 165 deletions

View file

@ -1,8 +1,6 @@
{ lib
, stdenv
, callPackage
, fetchFromGitHub
, fetchurl
, autoPatchelfHook
, makeWrapper
, buildNpmPackage
@ -14,7 +12,6 @@
, libxcb
, openssl
, libopus
, ffmpeg_5-full
, boost
, pkg-config
, libdrm
@ -23,47 +20,45 @@
, libcap
, mesa
, curl
, pcre
, pcre2
, libuuid
, libselinux
, libsepol
, libthai
, libdatrie
, libxkbcommon
, libepoxy
, libva
, libvdpau
, numactl
, amf-headers
, intel-media-sdk
, svt-av1
, vulkan-loader
, libappindicator
, libnotify
, config
, cudaSupport ? config.cudaSupport
, 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.20.0";
version = "0.21.0";
src = fetchFromGitHub {
owner = "LizardByte";
repo = "Sunshine";
rev = "v${version}";
sha256 = "sha256-/ceN44PAEtXzrAUi4AEldW1FBhJqIXah1Zd0S6fiV3s=";
sha256 = "sha256-uvQAJkoKazFLz5iTpYSAGYJQZ2EprQ+p9+tryqorFHM=";
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";
npmDepsHash = "sha256-pwmkpZjDwluKJjcY0ehetQbAlFnj1tsW100gRjolboc=";
npmDepsHash = "sha256-+T1XAf4SThoJLOFpnVxDa2qiKFLIKQPGewjA83GQovM=";
dontNpmBuild = true;
@ -88,9 +83,7 @@ stdenv.mkDerivation rec {
];
buildInputs = [
libcbs
avahi
ffmpeg_5-full
libevdev
libpulseaudio
xorg.libX11
@ -109,6 +102,16 @@ stdenv.mkDerivation rec {
libcap
libdrm
curl
pcre
pcre2
libuuid
libselinux
libsepol
libthai
libdatrie
xorg.libXdmcp
libxkbcommon
libepoxy
libva
libvdpau
numactl
@ -116,8 +119,11 @@ stdenv.mkDerivation rec {
amf-headers
svt-av1
libappindicator
libnotify
] ++ lib.optionals cudaSupport [
cudaPackages.cudatoolkit
] ++ lib.optionals stdenv.isx86_64 [
intel-media-sdk
];
runtimeDependencies = [
@ -132,16 +138,13 @@ stdenv.mkDerivation rec {
];
postPatch = ''
# fix hardcoded libevdev and icon path
substituteInPlace CMakeLists.txt \
--replace '/usr/include/libevdev-1.0' '${libevdev}/include/libevdev-1.0' \
--replace '/usr/share' "$out/share"
# fix hardcoded libevdev path
substituteInPlace cmake/compile_definitions/linux.cmake \
--replace '/usr/include/libevdev-1.0' '${libevdev}/include/libevdev-1.0'
substituteInPlace packaging/linux/sunshine.desktop \
--replace '@PROJECT_NAME@' 'Sunshine'
# add FindFFMPEG to source tree
cp ${findFfmpeg} cmake/FindFFMPEG.cmake
--replace '@PROJECT_NAME@' 'Sunshine' \
--replace '@PROJECT_DESCRIPTION@' 'Self-hosted game stream host for Moonlight'
'';
preBuild = ''
@ -163,7 +166,7 @@ stdenv.mkDerivation rec {
passthru.updateScript = ./updater.sh;
meta = with lib; {
description = "Sunshine is a Game stream host for Moonlight.";
description = "Sunshine is a Game stream host for Moonlight";
homepage = "https://github.com/LizardByte/Sunshine";
license = licenses.gpl3Only;
maintainers = with maintainers; [ devusb ];

View file

@ -1,75 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ccca6fc..8789a4a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -349,6 +349,8 @@ else()
set(WAYLAND_FOUND OFF)
endif()
+ find_package(FFMPEG REQUIRED)
+
if(X11_FOUND)
add_compile_definitions(SUNSHINE_BUILD_X11)
include_directories(SYSTEM ${X11_INCLUDE_DIR})
@@ -547,43 +549,7 @@ set_source_files_properties(third-party/nanors/rs.c
list(APPEND SUNSHINE_DEFINITIONS SUNSHINE_TRAY=${SUNSHINE_TRAY})
-# 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 mfx)
-elseif(APPLE)
- 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()
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)
-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/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})
@@ -593,7 +559,6 @@ include_directories(
${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}
)
@@ -627,7 +592,9 @@ list(APPEND SUNSHINE_EXTERNAL_LIBRARIES
${CMAKE_THREAD_LIBS_INIT}
enet
opus
+ cbs
${FFMPEG_LIBRARIES}
+ ${FFMPEG_PLATFORM_LIBRARIES}
${Boost_LIBRARIES}
${OPENSSL_LIBRARIES}
${CURL_LIBRARIES}

View file

@ -1,48 +0,0 @@
{ 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

@ -5,15 +5,15 @@
"packages": {
"": {
"dependencies": {
"@fortawesome/fontawesome-free": "6.4.0",
"bootstrap": "5.2.3",
"@fortawesome/fontawesome-free": "6.4.2",
"bootstrap": "5.3.2",
"vue": "2.6.12"
}
},
"node_modules/@fortawesome/fontawesome-free": {
"version": "6.4.0",
"resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-6.4.0.tgz",
"integrity": "sha512-0NyytTlPJwB/BF5LtRV8rrABDbe3TdTXqNB3PdZ+UUUZAEIrdOJdmABqKjt4AXwIoJNaRVVZEXxpNrqvE1GAYQ==",
"version": "6.4.2",
"resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-6.4.2.tgz",
"integrity": "sha512-m5cPn3e2+FDCOgi1mz0RexTUvvQibBebOUlUlW0+YrMjDTPkiJ6VTKukA1GRsvRw+12KyJndNjj0O4AgTxm2Pg==",
"hasInstallScript": true,
"engines": {
"node": ">=6"
@ -30,9 +30,9 @@
}
},
"node_modules/bootstrap": {
"version": "5.2.3",
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.2.3.tgz",
"integrity": "sha512-cEKPM+fwb3cT8NzQZYEu4HilJ3anCrWqh3CHAok1p9jXqMPsPTBhU25fBckEJHJ/p+tTxTFTsFQGM+gaHpi3QQ==",
"version": "5.3.2",
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.3.2.tgz",
"integrity": "sha512-D32nmNWiQHo94BKHLmOrdjlL05q1c8oxbtBphQFb9Z5to6eGRDCm0QgeaZ4zFBHzfg2++rqa2JkqCcxDy0sH0g==",
"funding": [
{
"type": "github",
@ -44,7 +44,7 @@
}
],
"peerDependencies": {
"@popperjs/core": "^2.11.6"
"@popperjs/core": "^2.11.8"
}
},
"node_modules/vue": {

View file

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