commit:     715edd21c8b64ec9d9f7ce84d07f7b54f57d85d4
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Sun Feb 18 15:15:14 2024 +0000
Commit:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Sun Feb 18 15:20:39 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=715edd21

net-misc/sunshine: On second thoughts, unbundle nv-codec-headers

Using the bundled copy is awkward as they need to be "installed". Loosen the
version requirement to just the same major version, which is probably fine.

Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>

 .../sunshine/files/sunshine-0.22.0-nvcodec.patch   | 27 ++++++++++++++++++++++
 net-misc/sunshine/sunshine-0.21.0.ebuild           |  8 ++-----
 net-misc/sunshine/sunshine-9999.ebuild             |  9 +++-----
 3 files changed, 32 insertions(+), 12 deletions(-)

diff --git a/net-misc/sunshine/files/sunshine-0.22.0-nvcodec.patch 
b/net-misc/sunshine/files/sunshine-0.22.0-nvcodec.patch
new file mode 100644
index 000000000000..bc7681beedf0
--- /dev/null
+++ b/net-misc/sunshine/files/sunshine-0.22.0-nvcodec.patch
@@ -0,0 +1,27 @@
+From 36b5a18ffd0cdf379b579db91bfaacc46e8c4757 Mon Sep 17 00:00:00 2001
+From: James Le Cuirot <[email protected]>
+Date: Sun, 18 Feb 2024 10:25:25 +0000
+Subject: [PATCH] Be less strict about the nv-codec-headers version
+
+Using the bundled version is awkward. Restrict the major version only
+and deal with any issues later.
+---
+ src/nvenc/nvenc_base.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/nvenc/nvenc_base.cpp b/src/nvenc/nvenc_base.cpp
+index b9eba5a..e11c4e2 100644
+--- a/src/nvenc/nvenc_base.cpp
++++ b/src/nvenc/nvenc_base.cpp
+@@ -11,7 +11,7 @@
+ // - NV_ENC_*_VER definitions where the value inside 
NVENCAPI_STRUCT_VERSION() was increased
+ // - Incompatible struct changes in nvEncodeAPI.h (fields removed, semantics 
changed, etc.)
+ // - Test both old and new drivers with all supported codecs
+-#if NVENCAPI_VERSION != MAKE_NVENC_VER(12U, 0U)
++#if NVENCAPI_MAJOR_VERSION != 12
+   #error Check and update NVENC code for backwards compatibility!
+ #endif
+ 
+-- 
+2.43.0
+

diff --git a/net-misc/sunshine/sunshine-0.21.0.ebuild 
b/net-misc/sunshine/sunshine-0.21.0.ebuild
index 57588f0457f6..163af1a4bea9 100644
--- a/net-misc/sunshine/sunshine-0.21.0.ebuild
+++ b/net-misc/sunshine/sunshine-0.21.0.ebuild
@@ -4,12 +4,10 @@
 EAPI=8
 
 # These don't necessarily have to align with the upstream release.
-# We do have nv-codec-headers packaged, but Sunshine is very picky here.
 BUILD_DEPS_COMMIT="2aafe061cd52a944cb3b5f86d1f25e9ad2a19bec"
 ENET_COMMIT="c6bb0e50118d08252eee308de8412751218442d6"
 MOONLIGHT_COMMIT="6e9ed871bc3e013386c775b2ee7d31deb1151068"
 NANORS_COMMIT="e9e242e98e27037830490b2a752895ca68f75f8b"
-NV_CODEC_COMMIT="22441b505d9d9afc1e3002290820909846c24bdc"
 TRAY_COMMIT="e08bdbe5aa7de0ad9c0ce36257016e07c7e6e2c0"
 SWS_COMMIT="27b41f5ee154cca0fce4fe2955dd886d04e3a4ed"
 WLRP_COMMIT="4264185db3b7e961e7f157e1cc4fd0ab75137568"
@@ -37,8 +35,6 @@ else
                        -> moonlight-common-c-${MOONLIGHT_COMMIT}.tar.gz
                
https://github.com/sleepybishop/nanors/archive/${NANORS_COMMIT}.tar.gz
                        -> nanors-${NANORS_COMMIT}.tar.gz
-               
https://github.com/FFmpeg/nv-codec-headers/archive/${NV_CODEC_COMMIT}.tar.gz
-                       -> nv-codec-headers-${NV_CODEC_COMMIT}.tar.gz
                https://github.com/LizardByte/tray/archive/${TRAY_COMMIT}.tar.gz
                        -> LizardByte-tray-${TRAY_COMMIT}.tar.gz
                
https://gitlab.com/eidheim/Simple-Web-Server/-/archive/${SWS_COMMIT}/Simple-Web-Server-${SWS_COMMIT}.tar.bz2
@@ -169,6 +165,7 @@ DEPEND="
        ${CDEPEND}
        media-libs/amf-headers
        media-libs/libva
+       =media-libs/nv-codec-headers-12*
        wayland? ( dev-libs/wayland-protocols )
 "
 
@@ -214,7 +211,7 @@ src_unpack() {
 
                local EGIT_REPO_URI="https://github.com/LizardByte/Sunshine.git";
                local EGIT_SUBMODULES=(
-                       
third-party/{moonlight-common-c{,/enet},nanors,nv-codec-headers,tray,Simple-Web-Server,wlr-protocols}
+                       
third-party/{moonlight-common-c{,/enet},nanors,tray,Simple-Web-Server,wlr-protocols}
                )
                unset EGIT_CHECKOUT_DIR EGIT_COMMIT EGIT_BRANCH
                git-r3_src_unpack
@@ -230,7 +227,6 @@ src_unpack() {
                ln -snf ../enet-${ENET_COMMIT} 
moonlight-common-c-${MOONLIGHT_COMMIT}/enet || die
                ln -snf ../../moonlight-common-c-${MOONLIGHT_COMMIT} 
"${S}"/third-party/moonlight-common-c || die
                ln -snf ../../nanors-${NANORS_COMMIT} "${S}"/third-party/nanors 
|| die
-               ln -snf ../../nv-codec-headers-${NV_CODEC_COMMIT} 
"${S}"/third-party/nv-codec-headers || die
                ln -snf ../../tray-${TRAY_COMMIT} "${S}"/third-party/tray || die
                ln -snf ../../Simple-Web-Server-${SWS_COMMIT} 
"${S}"/third-party/Simple-Web-Server || die
                ln -snf ../../wlr-protocols-${WLRP_COMMIT} 
"${S}"/third-party/wlr-protocols || die

diff --git a/net-misc/sunshine/sunshine-9999.ebuild 
b/net-misc/sunshine/sunshine-9999.ebuild
index 99a8ab606364..b99c07ff71f6 100644
--- a/net-misc/sunshine/sunshine-9999.ebuild
+++ b/net-misc/sunshine/sunshine-9999.ebuild
@@ -4,12 +4,10 @@
 EAPI=8
 
 # These don't necessarily have to align with the upstream release.
-# We do have nv-codec-headers packaged, but Sunshine is very picky here.
 BUILD_DEPS_COMMIT="2aafe061cd52a944cb3b5f86d1f25e9ad2a19bec"
 ENET_COMMIT="c6bb0e50118d08252eee308de8412751218442d6"
 MOONLIGHT_COMMIT="6e9ed871bc3e013386c775b2ee7d31deb1151068"
 NANORS_COMMIT="e9e242e98e27037830490b2a752895ca68f75f8b"
-NV_CODEC_COMMIT="22441b505d9d9afc1e3002290820909846c24bdc"
 TRAY_COMMIT="e08bdbe5aa7de0ad9c0ce36257016e07c7e6e2c0"
 SWS_COMMIT="27b41f5ee154cca0fce4fe2955dd886d04e3a4ed"
 WLRP_COMMIT="4264185db3b7e961e7f157e1cc4fd0ab75137568"
@@ -37,8 +35,6 @@ else
                        -> moonlight-common-c-${MOONLIGHT_COMMIT}.tar.gz
                
https://github.com/sleepybishop/nanors/archive/${NANORS_COMMIT}.tar.gz
                        -> nanors-${NANORS_COMMIT}.tar.gz
-               
https://github.com/FFmpeg/nv-codec-headers/archive/${NV_CODEC_COMMIT}.tar.gz
-                       -> nv-codec-headers-${NV_CODEC_COMMIT}.tar.gz
                https://github.com/LizardByte/tray/archive/${TRAY_COMMIT}.tar.gz
                        -> LizardByte-tray-${TRAY_COMMIT}.tar.gz
                
https://gitlab.com/eidheim/Simple-Web-Server/-/archive/${SWS_COMMIT}/Simple-Web-Server-${SWS_COMMIT}.tar.bz2
@@ -169,6 +165,7 @@ DEPEND="
        ${CDEPEND}
        dev-cpp/nlohmann_json
        media-libs/amf-headers
+       =media-libs/nv-codec-headers-12*
        wayland? ( dev-libs/wayland-protocols )
 "
 
@@ -183,6 +180,7 @@ BDEPEND="
 PATCHES=(
        "${FILESDIR}"/${PN}-custom-ffmpeg.patch
        "${FILESDIR}"/${PN}-system-json.patch
+       "${FILESDIR}"/${PN}-0.22.0-nvcodec.patch
 )
 
 # Make this mess a bit simpler.
@@ -213,7 +211,7 @@ src_unpack() {
 
                local EGIT_REPO_URI="https://github.com/LizardByte/Sunshine.git";
                local EGIT_SUBMODULES=(
-                       
third-party/{moonlight-common-c{,/enet},nanors,nv-codec-headers,tray,Simple-Web-Server,wlr-protocols}
+                       
third-party/{moonlight-common-c{,/enet},nanors,tray,Simple-Web-Server,wlr-protocols}
                )
                unset EGIT_CHECKOUT_DIR EGIT_COMMIT EGIT_BRANCH
                git-r3_src_unpack
@@ -229,7 +227,6 @@ src_unpack() {
                ln -snf ../enet-${ENET_COMMIT} 
moonlight-common-c-${MOONLIGHT_COMMIT}/enet || die
                ln -snf ../../moonlight-common-c-${MOONLIGHT_COMMIT} 
"${S}"/third-party/moonlight-common-c || die
                ln -snf ../../nanors-${NANORS_COMMIT} "${S}"/third-party/nanors 
|| die
-               ln -snf ../../nv-codec-headers-${NV_CODEC_COMMIT} 
"${S}"/third-party/nv-codec-headers || die
                ln -snf ../../tray-${TRAY_COMMIT} "${S}"/third-party/tray || die
                ln -snf ../../Simple-Web-Server-${SWS_COMMIT} 
"${S}"/third-party/Simple-Web-Server || die
                ln -snf ../../wlr-protocols-${WLRP_COMMIT} 
"${S}"/third-party/wlr-protocols || die

Reply via email to