ref:ec09aad6c6ed4a2b4eb4e438fab337fa94e183dc

build(Linux): harden Qt6 dependency detection (#5679)

SHA: ec09aad6c6ed4a2b4eb4e438fab337fa94e183dc
Author: Dave Lane <42013603+ReenigneArcher@users.noreply.github.com>
Date: 2026-09-10 22:09
Parents: a903885
4 files changed +27 -3
Type
cmake/dependencies/common.cmake +11 −0
@@ -56,6 +56,17 @@
add_subdirectory("${CMAKE_SOURCE_DIR}/third-party/tray")
# TRAY_QT_VERSION is scoped to the tray subdirectory, so inspect the target's actual dependencies.
get_target_property(_sunshine_tray_link_libraries tray LINK_LIBRARIES)
if("Qt6::Widgets" IN_LIST _sunshine_tray_link_libraries)
set(SUNSHINE_TRAY_QT_VERSION 6)
elseif("Qt5::Widgets" IN_LIST _sunshine_tray_link_libraries)
set(SUNSHINE_TRAY_QT_VERSION 5)
else()
message(FATAL_ERROR "Could not determine the Qt version used by the tray target.")
endif()
unset(_sunshine_tray_link_libraries)
if(BUILD_TESTS)
target_compile_definitions(tray PRIVATE TRAY_ENABLE_TEST_HOOKS)
endif()
cmake/packaging/linux.cmake +4 −2
@@ -163,7 +163,7 @@
# Icons used by the Qt tray backend are no longer installed to the hicolor icon theme,
# because Qt6 will not allow icons not part of the theme... so we will use icons from our web directory instead
if(TRAY_QT_VERSION EQUAL 6)
if(SUNSHINE_TRAY_QT_VERSION EQUAL 6)
set(CPACK_DEBIAN_PACKAGE_DEPENDS "\
${CPACK_DEBIAN_PACKAGE_DEPENDS}, \
libqt6widgets6, \
@@ -178,7 +178,7 @@
devel/qt6-base
graphics/qt6-svg
)
else()
elseif(SUNSHINE_TRAY_QT_VERSION EQUAL 5)
set(CPACK_DEBIAN_PACKAGE_DEPENDS "\
${CPACK_DEBIAN_PACKAGE_DEPENDS}, \
libqt5widgets5, \
@@ -193,5 +193,7 @@
x11-toolkits/qt5-widgets
graphics/qt5-svg
)
else()
message(FATAL_ERROR "Unsupported tray Qt version: ${SUNSHINE_TRAY_QT_VERSION}")
endif()
endif()
docker/debian.dockerfile +11 −0
@@ -78,6 +78,17 @@
./scripts/linux_build.sh \
--step=package \
--sudo-off
package_dependencies="$(dpkg-deb --field build/cpack_artifacts/*.deb Depends)"
package_dependencies_valid=false
case "${package_dependencies}" in
*libqt5*) ;;
*libqt6widgets6*libqt6svg6* | *libqt6svg6*libqt6widgets6*) package_dependencies_valid=true ;;
esac
if [ "${package_dependencies_valid}" = false ]; then
echo "Unexpected Qt package dependencies: ${package_dependencies}"
exit 1
fi
_BUILD
# run tests
docs/getting_started.md +1 −1
@@ -202,7 +202,7 @@
Download `sunshine_{version}-1+{distro}{distro-version}_{arch}.deb` and run the following command.
```bash
sudo dpkg -i ./sunshine_{version}-1+{distro}{distro-version}_{arch}.deb
sudo apt install ./sunshine_{version}-1+{distro}{distro-version}_{arch}.deb
```
> [!NOTE]