From 70fefaa49ca99039f9338c93e588b06e06b41020 Mon Sep 17 00:00:00 2001 From: Jan Grulich Date: Mon, 16 Jun 2025 16:14:58 +0200 Subject: [PATCH] Backport - CMake: Do not automatically link against Qt6::QmlPrivate Resolves: RHEL-78535 --- qt6-qtdeclarative.spec | 11 +++- ...utomatically-link-against-qmlprivate.patch | 50 +++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 qtdeclarative-cmake-do-not-automatically-link-against-qmlprivate.patch diff --git a/qt6-qtdeclarative.spec b/qt6-qtdeclarative.spec index 73c5564..1f0c526 100644 --- a/qt6-qtdeclarative.spec +++ b/qt6-qtdeclarative.spec @@ -17,7 +17,7 @@ Summary: Qt6 - QtDeclarative component Name: qt6-%{qt_module} Version: 6.9.1 -Release: 1%{?dist} +Release: 2%{?dist} License: LGPL-3.0-only OR GPL-3.0-only WITH Qt-GPL-exception-1.0 Url: http://www.qt.io @@ -35,6 +35,11 @@ Source0: https://download.qt.io/official_releases/qt/%{majmin}/%{version}/submod Source5: qv4global_p-multilib.h ## upstream patches +# Backport from Qt 6.10 +# Requires code using QML private API to specifically link against Qt6:QmlPrivate +# https://bugreports.qt.io/browse/QTBUG-87776 +# https://bugzilla.redhat.com/show_bug.cgi?id=2330219 +Patch0: qtdeclarative-cmake-do-not-automatically-link-against-qmlprivate.patch ## upstreamable patches @@ -736,6 +741,10 @@ make check -k -C tests ||: %endif %changelog +* Mon Jun 16 2025 Jan Grulich - 6.9.1-2 +- Backport - CMake: Do not automatically link against Qt6::QmlPrivate + Resolves: RHEL-78535 + * Wed May 14 2025 Jan Grulich - 6.9.1-1 - 6.9.1 Resolves: RHEL-78535 diff --git a/qtdeclarative-cmake-do-not-automatically-link-against-qmlprivate.patch b/qtdeclarative-cmake-do-not-automatically-link-against-qmlprivate.patch new file mode 100644 index 0000000..8f813e5 --- /dev/null +++ b/qtdeclarative-cmake-do-not-automatically-link-against-qmlprivate.patch @@ -0,0 +1,50 @@ +From 3b0dab39d047cfc676a75915ce606cbd4d43a83d Mon Sep 17 00:00:00 2001 +From: Alexandru Croitor +Date: Mon, 27 Jan 2025 11:20:12 +0100 +Subject: [PATCH] CMake: Do not automatically link against Qt6::QmlPrivate + +Generally, QML modules should not require private API. It might have +been the case that generated code (by e.g. qmlcachegen) included private +headers, but this is no longer the case. + +This might break code using the commercial only qmslc in direct mode +(which might need private Qt headers), but the general advise has been +to explicitly link against the private module when doing so (and it is +already necessary for other Qt modules, like Quick). + +[ChangeLog][Important Behavior Change][QtQml] QML modules created by +qt_add_qml_module no longer link against the Qt6::QmlPrivate target by +default. Modules that intentionally use private API must now explicitly +link against it. + +Original-patch-by: Alexandru Croitor +Task-number: QTBUG-87776 +Change-Id: I8c4c32673d88bb4d976d65ab10a0dc39f5e49596 +Reviewed-by: Ulf Hermann +Reviewed-by: Alexandru Croitor +--- + src/qml/Qt6QmlMacros.cmake | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/qml/Qt6QmlMacros.cmake b/src/qml/Qt6QmlMacros.cmake +index fae94d6b..325d5767 100644 +--- a/src/qml/Qt6QmlMacros.cmake ++++ b/src/qml/Qt6QmlMacros.cmake +@@ -1695,7 +1695,7 @@ function(_qt_internal_target_enable_qmlcachegen target qmlcachegen) + # TODO: Probably need to reject ${target} being an object library as unsupported + target_sources(${target} PRIVATE "${qmlcache_loader_cpp}") + target_link_libraries(${target} PRIVATE +- ${QT_CMAKE_EXPORT_NAMESPACE}::QmlPrivate ++ ${QT_CMAKE_EXPORT_NAMESPACE}::Qml + ${QT_CMAKE_EXPORT_NAMESPACE}::Core + ) + endfunction() +@@ -3902,7 +3902,7 @@ function(_qt_internal_qml_type_registration target) + endif() + + target_include_directories(${effective_target} PRIVATE +- $ ++ $ + ) + endfunction() +