commit:     0b1973e5e40b0d604b32aae8aa128aee213987fd
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 18 21:05:03 2025 +0000
Commit:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Fri Jul 18 21:05:54 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0b1973e5

net-misc/sunshine: Backport upstream fix to build without USE=libdrm

Closes: https://bugs.gentoo.org/959436
Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>

 .../sunshine/files/sunshine-wayland-libdrm.patch   | 39 ++++++++++++++++++++++
 net-misc/sunshine/sunshine-2025.628.4510.ebuild    |  6 +++-
 net-misc/sunshine/sunshine-9999.ebuild             |  5 ++-
 3 files changed, 48 insertions(+), 2 deletions(-)

diff --git a/net-misc/sunshine/files/sunshine-wayland-libdrm.patch 
b/net-misc/sunshine/files/sunshine-wayland-libdrm.patch
new file mode 100644
index 000000000000..af810aa65489
--- /dev/null
+++ b/net-misc/sunshine/files/sunshine-wayland-libdrm.patch
@@ -0,0 +1,39 @@
+From 35f0b30845e79a0c4adfbdae6de64fcbd197531b Mon Sep 17 00:00:00 2001
+From: ReenigneArcher <[email protected]>
+Date: Sat, 12 Jul 2025 20:41:17 -0400
+Subject: [PATCH] build(wayland): ensure libdrm is found (#4070)
+
+--- a/cmake/compile_definitions/linux.cmake
++++ b/cmake/compile_definitions/linux.cmake
+@@ -85,18 +85,27 @@ if(CUDA_FOUND)
+     add_compile_definitions(SUNSHINE_BUILD_CUDA)
+ endif()
+ 
++# libdrm is required for both DRM (KMS) and Wayland
++if(${SUNSHINE_ENABLE_DRM} OR ${SUNSHINE_ENABLE_WAYLAND})
++    find_package(LIBDRM REQUIRED)
++else()
++    set(LIBDRM_FOUND OFF)
++endif()
++if(LIBDRM_FOUND)
++    include_directories(SYSTEM ${LIBDRM_INCLUDE_DIRS})
++    list(APPEND PLATFORM_LIBRARIES ${LIBDRM_LIBRARIES})
++endif()
++
+ # drm
+ if(${SUNSHINE_ENABLE_DRM})
+-    find_package(LIBDRM REQUIRED)
+     find_package(LIBCAP REQUIRED)
+ else()
+-    set(LIBDRM_FOUND OFF)
+     set(LIBCAP_FOUND OFF)
+ endif()
+ if(LIBDRM_FOUND AND LIBCAP_FOUND)
+     add_compile_definitions(SUNSHINE_BUILD_DRM)
+-    include_directories(SYSTEM ${LIBDRM_INCLUDE_DIRS} ${LIBCAP_INCLUDE_DIRS})
+-    list(APPEND PLATFORM_LIBRARIES ${LIBDRM_LIBRARIES} ${LIBCAP_LIBRARIES})
++    include_directories(SYSTEM ${LIBCAP_INCLUDE_DIRS})
++    list(APPEND PLATFORM_LIBRARIES ${LIBCAP_LIBRARIES})
+     list(APPEND PLATFORM_TARGET_FILES
+             "${CMAKE_SOURCE_DIR}/src/platform/linux/kmsgrab.cpp")
+     list(APPEND SUNSHINE_DEFINITIONS EGL_NO_X11=1)

diff --git a/net-misc/sunshine/sunshine-2025.628.4510.ebuild 
b/net-misc/sunshine/sunshine-2025.628.4510.ebuild
index 1067e6784a3d..b4bff594534d 100644
--- a/net-misc/sunshine/sunshine-2025.628.4510.ebuild
+++ b/net-misc/sunshine/sunshine-2025.628.4510.ebuild
@@ -149,7 +149,10 @@ CDEPEND="
                x11-libs/libnotify
        )
        vaapi? ( media-libs/libva:=[wayland?,X?] )
-       wayland? ( dev-libs/wayland )
+       wayland? (
+               dev-libs/wayland
+               x11-libs/libdrm
+       )
        X? ( x11-libs/libX11 )
        x264? ( media-libs/x264:= )
        x265? ( media-libs/x265:= )
@@ -185,6 +188,7 @@ BDEPEND="
 PATCHES=(
        "${FILESDIR}"/${PN}-2025.122.141614-nvcodec.patch
        "${FILESDIR}"/${PN}-tray-notification-cb.patch
+       "${FILESDIR}"/${PN}-wayland-libdrm.patch
        "${FILESDIR}"/ffmpeg-7.1.1-svt-av1-3.patch
 )
 

diff --git a/net-misc/sunshine/sunshine-9999.ebuild 
b/net-misc/sunshine/sunshine-9999.ebuild
index 94847607830a..b3ca8d911dbd 100644
--- a/net-misc/sunshine/sunshine-9999.ebuild
+++ b/net-misc/sunshine/sunshine-9999.ebuild
@@ -149,7 +149,10 @@ CDEPEND="
                x11-libs/libnotify
        )
        vaapi? ( media-libs/libva:=[wayland?,X?] )
-       wayland? ( dev-libs/wayland )
+       wayland? (
+               dev-libs/wayland
+               x11-libs/libdrm
+       )
        X? ( x11-libs/libX11 )
        x264? ( media-libs/x264:= )
        x265? ( media-libs/x265:= )

Reply via email to