From bfd4878eeaae43f6ff1d08b3f972705fd105634a Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Thu, 10 Sep 2026 14:59:53 -0400 Subject: [PATCH] build(Linux): harden Qt6 dependency detection --- cmake/dependencies/common.cmake | 11 +++++++++++ cmake/packaging/linux.cmake | 6 ++++-- docker/debian.dockerfile | 11 +++++++++++ docs/getting_started.md | 2 +- 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/cmake/dependencies/common.cmake b/cmake/dependencies/common.cmake index b0ec16d34d9..b83c601ea8f 100644 --- a/cmake/dependencies/common.cmake +++ b/cmake/dependencies/common.cmake @@ -56,6 +56,17 @@ if(SUNSHINE_ENABLE_TRAY) 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() diff --git a/cmake/packaging/linux.cmake b/cmake/packaging/linux.cmake index 61ca4d3bf5d..32a7d97c9e8 100644 --- a/cmake/packaging/linux.cmake +++ b/cmake/packaging/linux.cmake @@ -163,7 +163,7 @@ if(${SUNSHINE_TRAY} STREQUAL 1) # 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 @@ if(${SUNSHINE_TRAY} STREQUAL 1) 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,6 +193,8 @@ if(${SUNSHINE_TRAY} STREQUAL 1) x11-toolkits/qt5-widgets graphics/qt5-svg ) + else() + message(FATAL_ERROR "Unsupported tray Qt version: ${SUNSHINE_TRAY_QT_VERSION}") endif() endif() diff --git a/docker/debian.dockerfile b/docker/debian.dockerfile index 8015c7c65b5..ec99ce29b41 100644 --- a/docker/debian.dockerfile +++ b/docker/debian.dockerfile @@ -78,6 +78,17 @@ set -e ./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 diff --git a/docs/getting_started.md b/docs/getting_started.md index a3591fa710e..daed9b11620 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -202,7 +202,7 @@ sudo apt install sunshine 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]