File 0001-Add-wayland-client-deps.patch of Package kodi

From c312b5d609747685023261c61e7d7a514f9b2f02 Mon Sep 17 00:00:00 2001
From: Tobias Klausmann <tobias.klausmann@freenet.de>
Date: Thu, 22 Dec 2022 19:18:51 +0100
Subject: [PATCH] Add wayland-client deps

---
 cmake/modules/FindWayland.cmake        | 68 ++++++++++++++++++++++++++
 cmake/platform/linux/wayland.cmake     |  2 +-
 cmake/scripts/linux/ExtraTargets.cmake |  2 +-
 3 files changed, 70 insertions(+), 2 deletions(-)
 create mode 100644 cmake/modules/FindWayland.cmake

diff --git a/cmake/modules/FindWayland.cmake b/cmake/modules/FindWayland.cmake
new file mode 100644
index 000000000..19eb79574
--- /dev/null
+++ b/cmake/modules/FindWayland.cmake
@@ -0,0 +1,68 @@
+# FindWayland
+# -------------
+# Finds the wayland library
+#
+# This will define the following variables::
+#
+# WAYLAND_FOUND        - the system has wayland
+# WAYLAND_INCLUDE_DIRS - the wayland include directory
+# WAYLAND_LIBRARIES    - the wayland libraries
+# WAYLAND_DEFINITIONS  - the wayland definitions
+# WAYLAND_SCANNER      - path to wayland-scanner
+
+pkg_check_modules(PC_WAYLAND wayland-client wayland-egl wayland-cursor QUIET)
+
+if(PC_WAYLAND_FOUND)
+  pkg_get_variable(PC_WAYLAND_PKGDATADIR wayland-client pkgdatadir)
+else()
+  message(SEND_ERROR "wayland-client not found via pkg-config")
+endif()
+
+pkg_check_modules(PC_WAYLAND_SCANNER wayland-scanner QUIET)
+
+if(PC_WAYLAND_SCANNER_FOUND)
+  pkg_get_variable(PC_WAYLAND_SCANNER wayland-scanner wayland_scanner)
+else()
+  message(SEND_ERROR "wayland-scanner not found via pkg-config")
+endif()
+
+find_path(WAYLAND_INCLUDE_DIR wayland-client.h PATH_SUFFIXES wayland PATHS ${PC_WAYLAND_INCLUDEDIR})
+
+find_library(WAYLAND_CLIENT_LIBRARY NAMES wayland-client
+                                      PATHS ${PC_WAYLAND_LIBRARY_DIRS})
+
+find_library(WAYLAND_CURSOR_LIBRARY NAMES wayland-cursor
+                                      PATHS ${PC_WAYLAND_LIBRARY_DIRS})
+
+find_library(WAYLAND_EGL NAMES wayland-egl
+                           PATHS ${PC_WAYLAND_LIBRARY_DIRS})
+
+
+# Promote to cache variables so all code can access it
+#set(WAYLAND_PROTOCOLS_DIR "${PC_WAYLAND_PKGDATADIR}/protocols" CACHE INTERNAL "")
+
+# wayland-scanner is from native/host system in case of cross-compilation, so
+# it's ok if we don't find it with pkgconfig
+find_program(WAYLAND_SCANNER wayland-scanner PATHS ${PC_WAYLAND_SCANNER})
+
+include (FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Wayland
+                                  REQUIRED_VARS WAYLAND_INCLUDE_DIR
+                                                WAYLAND_CLIENT_LIBRARY
+                                                WAYLAND_CURSOR_LIBRARY
+                                                WAYLAND_EGL
+                                                WAYLAND_SCANNER
+                                  VERSION_VAR WAYLAND_wayland-client_VERSION)
+
+if(WAYLAND_FOUND)
+  set(WAYLAND_INCLUDE_DIRS ${WAYLAND_INCLUDE_DIR})
+  set(WAYLAND_LIBRARIES ${WAYLAND_CLIENT_LIBRARY}
+                          ${WAYLAND_CURSOR_LIBRARY}
+                          ${WAYLAND_EGL})
+  set(WAYLAND_DEFINITIONS -DHAVE_WAYLAND=1)
+endif()
+
+mark_as_advanced(WAYLAND_INCLUDE_DIR
+                 WAYLAND_CLIENT_LIBRARY
+                 WAYLAND_CURSOR_LIBRARY
+                 WAYLAND_EGL WAYLAND_SCANNER)
diff --git a/cmake/platform/linux/wayland.cmake b/cmake/platform/linux/wayland.cmake
index 1adcd8fe7..adce70b3a 100644
--- a/cmake/platform/linux/wayland.cmake
+++ b/cmake/platform/linux/wayland.cmake
@@ -1,4 +1,4 @@
-list(APPEND PLATFORM_REQUIRED_DEPS WaylandProtocols>=1.7 Waylandpp>=0.2.2 LibDRM Xkbcommon>=0.4.1)
+list(APPEND PLATFORM_REQUIRED_DEPS WaylandProtocols>=1.7 Waylandpp>=0.2.2 LibDRM Xkbcommon>=0.4.1 Wayland)
 list(APPEND PLATFORM_OPTIONAL_DEPS VAAPI)
 
 if(APP_RENDER_SYSTEM STREQUAL "gl")
-- 
2.39.0

openSUSE Build Service is sponsored by