Submitted By: Zeckma Date: 2025-04-09 Initial Package Version: 31.0.3 Upstream Status: Sent but will NOT be merged Origin: Self Description: This patch allows Mesa's EGL library to be used, as CMake's find_package(OpenGL::EGL) reports false if libglvnd is not installed. This is a problem. Most distros install libglvnd, but BLFS doesn't, and GLFS gives the option. --- obs-studio-31.0.3-sources.orig/deps/glad/CMakeLists.txt 2025-03-28 13:40:03.000000000 -0600 +++ obs-studio-31.0.3-sources/deps/glad/CMakeLists.txt 2025-04-09 22:55:06.758028267 -0600 @@ -5,17 +5,33 @@ add_library(obsglad OBJECT) add_library(OBS::glad ALIAS obsglad) +find_package(PkgConfig REQUIRED) +pkg_check_modules(EGL QUIET egl) +target_link_libraries(obsglad PUBLIC ${EGL_LIBRARIES}) +target_include_directories(obsglad PUBLIC ${EGL_INCLUDE_DIRS}) +target_compile_options(obsglad PUBLIC ${EGL_CFLAGS_OTHER}) + +set(GLAD_SOURCES_PRIVATE + src/glad.c + "$<$:src/glad_wgl.c>") +set(GLAD_SOURCES_PUBLIC + include/glad/glad.h + "$<$:${CMAKE_CURRENT_SOURCE_DIR}/include/glad/glad_wgl.h>") + +if(EGL_FOUND) + list(APPEND GLAD_SOURCES_PRIVATE + src/glad_egl.c + include/EGL/eglplatform.h) + list(APPEND GLAD_SOURCES_PUBLIC + "${CMAKE_CURRENT_SOURCE_DIR}/include/glad/glad_egl.h") +endif() + target_sources( obsglad PRIVATE - src/glad.c - $<$:src/glad_wgl.c> - $<$:src/glad_egl.c> - $<$:include/EGL/eglplatform.h> + ${GLAD_SOURCES_PRIVATE} PUBLIC - include/glad/glad.h - "$<$:${CMAKE_CURRENT_SOURCE_DIR}/include/glad/glad_wgl.h>" - "$<$:${CMAKE_CURRENT_SOURCE_DIR}/include/glad/glad_egl.h>" + ${GLAD_SOURCES_PUBLIC} ) target_compile_options(obsglad PRIVATE $<$:-Wno-strict-prototypes>) @@ -25,7 +41,7 @@ target_link_libraries( obsglad PRIVATE $<$>:${CMAKE_DL_LIBS}> - PUBLIC OpenGL::GL $<$:OpenGL::EGL> + PUBLIC OpenGL::GL ) set_target_properties(obsglad PROPERTIES FOLDER deps POSITION_INDEPENDENT_CODE TRUE) --- obs-studio-31.0.3-sources.orig/libobs-opengl/CMakeLists.txt 2025-03-28 13:40:03.000000000 -0600 +++ obs-studio-31.0.3-sources/libobs-opengl/CMakeLists.txt 2025-04-09 22:54:52.688546142 -0600 @@ -13,7 +13,11 @@ find_package(X11-xcb REQUIRED) if(ENABLE_WAYLAND) - find_package(OpenGL REQUIRED EGL) + find_package(PkgConfig REQUIRED) + pkg_check_modules(EGL REQUIRED egl) + target_link_libraries(libobs-opengl PRIVATE ${EGL_LIBRARIES}) + target_include_directories(libobs-opengl PRIVATE ${EGL_INCLUDE_DIRS}) + target_compile_options(libobs-opengl PRIVATE ${EGL_CFLAGS_OTHER}) find_package(Wayland REQUIRED) endif() endif() @@ -56,7 +60,6 @@ "$<$:$>" $<$:xcb::xcb> $<$:X11::x11-xcb> - $<$,$>:OpenGL::EGL> $<$,$>:Wayland::EGL> )