media-video/obs-studio: fix build with qt 6.10

Closes: https://bugs.gentoo.org/966051
Signed-off-by: Jimi Huotari <chiitoo@gentoo.org>
This commit is contained in:
Jimi Huotari 2025-11-14 21:17:19 +02:00
parent c06236741d
commit c89bf99878
No known key found for this signature in database
GPG Key ID: FAC2CB8201626193
2 changed files with 397 additions and 0 deletions

View File

@ -0,0 +1,113 @@
# Gentoo Bug: https://bugs.gentoo.org/966051
# Upstream Pull Request: https://github.com/obsproject/obs-studio/pull/12328
From 26dfacbd4f5217258a2f1c5472a544c65a182d10 Mon Sep 17 00:00:00 2001
From: tytan652 <tytan652@tytanium.xyz>
Date: Tue, 1 Jul 2025 20:53:48 +0200
Subject: [PATCH] frontend: Cleanup Qt GuiPrivate linkage
Remove unneeded linkages and guard needed ones for Qt versions earlier
than 6.9.0.
---
frontend/cmake/os-freebsd.cmake | 6 +++++-
frontend/cmake/os-linux.cmake | 6 +++++-
frontend/plugins/aja-output-ui/CMakeLists.txt | 3 ---
frontend/plugins/decklink-output-ui/CMakeLists.txt | 3 ---
frontend/plugins/frontend-tools/CMakeLists.txt | 2 --
5 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/frontend/cmake/os-freebsd.cmake b/frontend/cmake/os-freebsd.cmake
index cb62e95199f57c..761cc985afda08 100644
--- a/frontend/cmake/os-freebsd.cmake
+++ b/frontend/cmake/os-freebsd.cmake
@@ -1,6 +1,10 @@
target_sources(obs-studio PRIVATE utility/platform-x11.cpp utility/system-info-posix.cpp)
target_compile_definitions(obs-studio PRIVATE OBS_INSTALL_PREFIX="${OBS_INSTALL_PREFIX}")
-target_link_libraries(obs-studio PRIVATE Qt::GuiPrivate Qt::DBus procstat)
+target_link_libraries(obs-studio PRIVATE Qt::DBus procstat)
+
+if(Qt6_VERSION AND Qt6_VERSION VERSION_LESS "6.9.0")
+ target_link_libraries(obs-studio PRIVATE Qt::GuiPrivate)
+endif()
find_package(Libpci REQUIRED)
target_link_libraries(obs-studio PRIVATE Libpci::pci)
diff --git a/frontend/cmake/os-linux.cmake b/frontend/cmake/os-linux.cmake
index 91e8bbad2fd771..1663b0bf6088ec 100644
--- a/frontend/cmake/os-linux.cmake
+++ b/frontend/cmake/os-linux.cmake
@@ -3,7 +3,11 @@ target_compile_definitions(
obs-studio
PRIVATE OBS_INSTALL_PREFIX="${OBS_INSTALL_PREFIX}" $<$<BOOL:${ENABLE_PORTABLE_CONFIG}>:ENABLE_PORTABLE_CONFIG>
)
-target_link_libraries(obs-studio PRIVATE Qt::GuiPrivate Qt::DBus)
+target_link_libraries(obs-studio PRIVATE Qt::DBus)
+
+if(Qt6_VERSION AND Qt6_VERSION VERSION_LESS "6.9.0")
+ target_link_libraries(obs-studio PRIVATE Qt::GuiPrivate)
+endif()
find_package(Libpci REQUIRED)
target_link_libraries(obs-studio PRIVATE Libpci::pci)
diff --git a/frontend/plugins/aja-output-ui/CMakeLists.txt b/frontend/plugins/aja-output-ui/CMakeLists.txt
index 37e4ba04de05a7..57f956e07e5cd3 100644
--- a/frontend/plugins/aja-output-ui/CMakeLists.txt
+++ b/frontend/plugins/aja-output-ui/CMakeLists.txt
@@ -10,8 +10,6 @@ find_package(LibAJANTV2 REQUIRED)
find_package(Qt6 REQUIRED Widgets)
if(OS_LINUX OR OS_FREEBSD OR OS_OPENBSD)
- find_package(Qt6 REQUIRED Gui)
-
find_package(X11 REQUIRED)
endif()
@@ -47,7 +45,6 @@ target_link_libraries(
Qt::Widgets
AJA::LibAJANTV2
$<$<PLATFORM_ID:Linux,FreeBSD,OpenBSD>:X11::X11>
- $<$<PLATFORM_ID:Linux,FreeBSD,OpenBSD>:Qt::GuiPrivate>
)
target_link_options(aja-output-ui PRIVATE $<$<PLATFORM_ID:Windows>:/IGNORE:4099>)
diff --git a/frontend/plugins/decklink-output-ui/CMakeLists.txt b/frontend/plugins/decklink-output-ui/CMakeLists.txt
index d72dac269ff5c5..99beb5668d33ec 100644
--- a/frontend/plugins/decklink-output-ui/CMakeLists.txt
+++ b/frontend/plugins/decklink-output-ui/CMakeLists.txt
@@ -8,8 +8,6 @@ endif()
find_package(Qt6 REQUIRED Widgets)
if(OS_LINUX OR OS_FREEBSD OR OS_OPENBSD)
- find_package(Qt6 REQUIRED Gui)
-
find_package(X11 REQUIRED)
endif()
@@ -38,7 +36,6 @@ target_link_libraries(
Qt::Widgets
"$<$<PLATFORM_ID:Darwin>:$<LINK_LIBRARY:FRAMEWORK,Cocoa.framework>>"
$<$<PLATFORM_ID:Linux,FreeBSD,OpenBSD>:X11::X11>
- $<$<PLATFORM_ID:Linux,FreeBSD,OpenBSD>:Qt::GuiPrivate>
)
if(OS_WINDOWS)
diff --git a/frontend/plugins/frontend-tools/CMakeLists.txt b/frontend/plugins/frontend-tools/CMakeLists.txt
index f7ffa4ae34acc3..b8afa7719e90ea 100644
--- a/frontend/plugins/frontend-tools/CMakeLists.txt
+++ b/frontend/plugins/frontend-tools/CMakeLists.txt
@@ -3,7 +3,6 @@ cmake_minimum_required(VERSION 3.28...3.30)
find_package(Qt6 REQUIRED Widgets)
if(OS_LINUX OR OS_FREEBSD OR OS_OPENBSD)
- find_package(Qt6 REQUIRED Gui)
find_package(X11 REQUIRED)
endif()
@@ -65,7 +64,6 @@ target_link_libraries(
Qt::Widgets
"$<$<PLATFORM_ID:Darwin>:$<LINK_LIBRARY:FRAMEWORK,Cocoa>>"
$<$<PLATFORM_ID:Linux,FreeBSD,OpenBSD>:X11::X11>
- $<$<PLATFORM_ID:Linux,FreeBSD,OpenBSD>:Qt::GuiPrivate>
)
add_subdirectory("${CMAKE_SOURCE_DIR}/shared/obs-scripting" "${CMAKE_BINARY_DIR}/shared/obs-scripting")

View File

@ -0,0 +1,284 @@
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
CMAKE_REMOVE_MODULES_LIST=( FindMbedTLS )
LUA_COMPAT=( luajit )
# For the time being upstream supports up to Python 3.12 only.
# Any issues found with 3.13+ should be reported as a Gentoo bug.
PYTHON_COMPAT=( python3_{11..14} )
inherit cmake flag-o-matic lua-single optfeature python-single-r1 xdg
CEF_AMD64="cef_binary_6533_linux_x86_64_v6"
CEF_ARM64="cef_binary_6533_linux_aarch64_v6"
OBS_BROWSER_COMMIT="a776dd6a1a0ded4a8a723f2f572f3f8a9707f5a8"
OBS_WEBSOCKET_COMMIT="1c9306b1e200704ebe192e06c893dfc06b097c43"
DESCRIPTION="Software for Recording and Streaming Live Video Content"
HOMEPAGE="https://obsproject.com"
if [[ ${PV} == 9999 ]]; then
inherit git-r3
EGIT_REPO_URI="https://github.com/obsproject/obs-studio.git"
EGIT_SUBMODULES=(
plugins/obs-browser
plugins/obs-websocket
)
else
SRC_URI="
https://github.com/obsproject/${PN}/archive/${PV}.tar.gz
-> ${P}.tar.gz
https://github.com/obsproject/obs-browser/archive/${OBS_BROWSER_COMMIT}.tar.gz
-> obs-browser-${OBS_BROWSER_COMMIT}.tar.gz
https://github.com/obsproject/obs-websocket/archive/${OBS_WEBSOCKET_COMMIT}.tar.gz
-> obs-websocket-${OBS_WEBSOCKET_COMMIT}.tar.gz
"
KEYWORDS="~amd64 ~arm64 ~ppc64 ~x86"
fi
SRC_URI+="
browser? (
amd64? ( https://cdn-fastly.obsproject.com/downloads/${CEF_AMD64}.tar.xz )
arm64? ( https://cdn-fastly.obsproject.com/downloads/${CEF_ARM64}.tar.xz )
)
"
LICENSE="Boost-1.0 GPL-2+ MIT Unlicense"
SLOT="0"
IUSE="
+alsa browser decklink fdk jack lua mpegts nvenc pipewire pulseaudio
python qsv sndio speex test-input truetype v4l vlc wayland websocket
"
REQUIRED_USE="
browser? ( || ( alsa pulseaudio ) )
lua? ( ${LUA_REQUIRED_USE} )
python? ( ${PYTHON_REQUIRED_USE} )
"
BDEPEND="
kde-frameworks/extra-cmake-modules:0
lua? ( dev-lang/swig )
python? ( dev-lang/swig )
"
# media-video/ffmpeg[opus] required due to bug 909566
# The websocket plug-in fails to build with 'dev-cpp/asio-1.34.0':
# https://github.com/obsproject/obs-websocket/issues/1291
DEPEND="
dev-cpp/nlohmann_json
dev-libs/glib:2
dev-libs/jansson:=
dev-libs/simde
dev-libs/uthash
dev-qt/qtbase:6[network,widgets,X,xml(+)]
dev-qt/qtsvg:6
media-libs/libglvnd[X]
media-libs/libva
media-libs/rnnoise
media-libs/x264:=
>=media-video/ffmpeg-6.1:=[nvenc?,opus,x264]
net-misc/curl
net-libs/mbedtls:3=
sys-apps/dbus
sys-apps/pciutils
sys-apps/util-linux
virtual/zlib:=
x11-libs/libdrm
x11-libs/libX11
x11-libs/libxcb:=
x11-libs/libXcomposite
x11-libs/libXfixes
x11-libs/libxkbcommon
alsa? ( media-libs/alsa-lib )
browser? (
>=app-accessibility/at-spi2-core-2.46.0:2
dev-libs/expat
dev-libs/glib
dev-libs/nspr
dev-libs/nss
media-libs/alsa-lib
media-libs/fontconfig
media-libs/mesa[gbm(+)]
net-print/cups
x11-libs/cairo
x11-libs/libXcursor
x11-libs/libXdamage
x11-libs/libXext
x11-libs/libXi
x11-libs/libxkbcommon
x11-libs/libXrandr
x11-libs/libXrender
x11-libs/libXScrnSaver
x11-libs/libxshmfence
x11-libs/libXtst
x11-libs/pango
)
fdk? ( media-libs/fdk-aac:= )
jack? ( virtual/jack )
lua? ( ${LUA_DEPS} )
mpegts? (
net-libs/librist
net-libs/srt
)
nvenc? ( >=media-libs/nv-codec-headers-12 )
pipewire? ( media-video/pipewire:= )
pulseaudio? ( media-libs/libpulse )
python? ( ${PYTHON_DEPS} )
qsv? ( media-libs/libvpl )
sndio? ( media-sound/sndio )
speex? ( media-libs/speexdsp )
truetype? (
media-libs/fontconfig
media-libs/freetype
)
v4l? (
media-libs/libv4l
virtual/udev
)
vlc? ( media-video/vlc:= )
wayland? (
dev-libs/wayland
x11-libs/libxkbcommon
)
websocket? (
<dev-cpp/asio-1.34.0
dev-cpp/websocketpp
dev-libs/qr-code-generator
)
"
RDEPEND="${DEPEND}"
QA_PREBUILT="
usr/lib*/obs-plugins/chrome-sandbox
usr/lib*/obs-plugins/libcef.so
usr/lib*/obs-plugins/libEGL.so
usr/lib*/obs-plugins/libGLESv2.so
usr/lib*/obs-plugins/libvk_swiftshader.so
usr/lib*/obs-plugins/libvulkan.so.1
usr/lib*/obs-plugins/swiftshader/libEGL.so
usr/lib*/obs-plugins/swiftshader/libGLESv2.so
"
PATCHES=(
# https://bugs.gentoo.org/966051
"${FILESDIR}/${PN}-32.0.2-fix-build-with-qt-6.10.patch"
)
pkg_setup() {
use lua && lua-single_pkg_setup
use python && python-single-r1_pkg_setup
}
src_unpack() {
default
if [[ ${PV} == 9999 ]]; then
git-r3_src_unpack
else
rm -d ${P}/plugins/obs-browser || die
mv obs-browser-${OBS_BROWSER_COMMIT} ${P}/plugins/obs-browser || die
rm -d ${P}/plugins/obs-websocket || die
mv obs-websocket-${OBS_WEBSOCKET_COMMIT} ${P}/plugins/obs-websocket || die
fi
}
src_prepare() {
# Un-comment after all patches are gone.
#default
# -Werror=lto-type-mismatch
# https://bugs.gentoo.org/867250
# https://github.com/obsproject/obs-studio/issues/8988
use wayland && filter-lto
cmake_src_prepare
}
src_configure() {
local libdir=$(get_libdir)
local mycmakeargs=(
-DCCACHE_PROGRAM=OFF
-DENABLE_ALSA=$(usex alsa)
-DENABLE_AJA=OFF
-DENABLE_BROWSER=$(usex browser)
-DENABLE_DECKLINK=$(usex decklink)
-DENABLE_FFMPEG_NVENC=$(usex nvenc)
-DENABLE_FREETYPE=$(usex truetype)
-DENABLE_JACK=$(usex jack)
-DENABLE_LIBFDK=$(usex fdk)
-DENABLE_NEW_MPEGTS_OUTPUT=$(usex mpegts)
-DENABLE_NVENC=$(usex nvenc)
-DENABLE_PIPEWIRE=$(usex pipewire)
-DENABLE_PULSEAUDIO=$(usex pulseaudio)
-DENABLE_QSV11=$(usex qsv)
-DENABLE_RNNOISE=ON
-DENABLE_SNDIO=$(usex sndio)
-DENABLE_SPEEXDSP=$(usex speex)
-DENABLE_TEST_INPUT=$(usex test-input)
-DENABLE_V4L2=$(usex v4l)
-DENABLE_VLC=$(usex vlc)
-DENABLE_VST=ON
-DENABLE_WAYLAND=$(usex wayland)
-DENABLE_WEBRTC=OFF # Requires libdatachannel.
-DENABLE_WEBSOCKET=$(usex websocket)
)
if [[ ${PV} != 9999 ]]; then
mycmakeargs+=(
-DOBS_VERSION_OVERRIDE=${PV}
)
fi
if use lua || use python; then
mycmakeargs+=(
-DENABLE_SCRIPTING_LUA=$(usex lua)
-DENABLE_SCRIPTING_PYTHON=$(usex python)
-DENABLE_SCRIPTING=ON
)
else
mycmakeargs+=( -DENABLE_SCRIPTING=OFF )
fi
if use browser; then
use amd64 && mycmakeargs+=( -DCEF_ROOT_DIR=../cef_binary_6533_linux_x86_64 )
use arm64 && mycmakeargs+=( -DCEF_ROOT_DIR=../cef_binary_6533_linux_aarch64 )
mycmakeargs+=( -DENABLE_WHATSNEW=ON )
else
mycmakeargs+=( -DENABLE_WHATSNEW=OFF )
fi
cmake_src_configure
}
src_install() {
cmake_src_install
# external plugins may need some things not installed by default, install them here
insinto /usr/include/obs/frontend/api
doins frontend/api/obs-frontend-api.h
}
pkg_postinst() {
xdg_pkg_postinst
if ! use alsa && ! use pulseaudio; then
elog
elog "For the audio capture features to be available,"
elog "at least one of the 'alsa' or 'pulseaudio' USE-flags needs to"
elog "be enabled."
elog
fi
if use v4l && has_version media-video/v4l2loopback; then
elog
elog "Depending on system configuration, the v4l2loopback kernel module"
elog "may need to be loaded manually, and needs to be re-built after"
elog "kernel changes."
elog
fi
optfeature "VA-API hardware encoding" media-video/ffmpeg[vaapi]
optfeature "virtual camera support" media-video/v4l2loopback
}