[graphics/krita] packaging: Fix deployment of QML files on three platforms

Dmitry Kazakov null at kde.org
Thu May 15 17:34:22 BST 2025


Git commit 09cb81ceaaf98f2eeef803d4bdd8b6e2e3a2efdd by Dmitry Kazakov.
Committed on 15/05/2025 at 16:32.
Pushed by dkazakov into branch 'master'.

Fix deployment of QML files on three platforms

The --qmldir argument of smthdeployqt was supposed to be used
for the **directory with qml files which are actually embedded into the
app as resources**, not just assorted modules that might be used or not.

The point is, that smthdeployqt does **not** embed what is passed
with --qmldir, but only **its dependencies**.

CC:kimageshop at kde.org

M  +18   -18   packaging/linux/appimage/build-image.sh
M  +1    -4    packaging/macos/osxdeploy.sh
M  +35   -13   packaging/windows/package-complete.py

https://invent.kde.org/graphics/krita/-/commit/09cb81ceaaf98f2eeef803d4bdd8b6e2e3a2efdd

diff --git a/packaging/linux/appimage/build-image.sh b/packaging/linux/appimage/build-image.sh
index 2be41c000b5..366101d62a8 100755
--- a/packaging/linux/appimage/build-image.sh
+++ b/packaging/linux/appimage/build-image.sh
@@ -195,18 +195,6 @@ cp -av --preserve=links $DEPS_INSTALL_PREFIX/lib/libharfbuzz.so.0* $APPDIR/usr/l
 cp -av --preserve=links $DEPS_INSTALL_PREFIX/lib/libfribidi.so.0* $APPDIR/usr/lib/
 cp -av --preserve=links $DEPS_INSTALL_PREFIX/lib/libfreetype.so.6* $APPDIR/usr/lib/
 
-## For some reason linuxdeployqt fails to deploy QtQuick.Layouts library into
-## the AppImage, so just copy it manually for now
-##
-## See the following related bugs for details:
-##     * https://github.com/linuxdeploy/linuxdeploy-plugin-qt/issues/1
-##     * https://github.com/probonopd/linuxdeployqt/issues/25
-
-if [ -d $DEPS_INSTALL_PREFIX/qml/QtQuick/Layouts ]; then
-    mkdir -p $APPDIR/usr/qml/QtQuick/Layouts
-    rsync -prul $DEPS_INSTALL_PREFIX/qml/QtQuick/Layouts $APPDIR/usr/qml/QtQuick/
-fi
-
 ## == MLT Dependencies and Resources ==
 cp -r $DEPS_INSTALL_PREFIX/share/mlt-7 $APPDIR/usr/share/mlt-7
 cp -r $DEPS_INSTALL_PREFIX/lib/mlt-7 $APPDIR/usr/lib/mlt-7
@@ -253,12 +241,24 @@ if [[ -d "$APPDIR/usr/lib/$TRIPLET" ]] ; then
   rm -rf $APPDIR/usr/lib/$TRIPLET/
 fi
 
-# Depending on the status of qt.conf file, qml destination path might be different,
-# fix that
+# A safeguard for the case when KDE_INSTALL_USE_QT_SYS_PATHS is not properly 
+# activated and the QML modules are installed into a default KDE's location instead
+# of the one returned by qtpath. If you see this error you should either recreate 
+# your build tree, or pass -DKDE_INSTALL_USE_QT_SYS_PATHS=ON to the build or check
+# if you have non-standard qt.conf in your installation root.
+
 if [ -d $APPDIR/usr/lib/qml ] ; then
-    mkdir -p $APPDIR/usr/qml
-    rsync -prul $APPDIR/usr/lib/qml/ $APPDIR/usr/qml/
-    rm -rf $APPDIR/usr/lib/qml
+    echo "ERROR: some of Krita's QML modules were installed in an incorrect location"
+    echo "    actual path: ${APPDIR}/lib/qml"
+    echo "    expected path: ${APPDIR}/qml"
+    exit 103
+fi
+
+if [ -d $DEPS_INSTALL_PREFIX/usr/lib/qml ] ; then
+    echo "ERROR: some of Deps' QML modules were installed in an incorrect location"
+    echo "    actual path: ${DEPS_INSTALL_PREFIX}/lib/qml"
+    echo "    expected path: ${DEPS_INSTALL_PREFIX}/qml"
+    exit 103
 fi
 
 # Step 3: Update the rpath in the various plugins we have to make sure they'll be loadable in an Appimage context
@@ -369,7 +369,7 @@ linuxdeployqt $APPDIR/usr/share/applications/org.kde.krita.desktop \
   -executable=$APPDIR/usr/bin/krita \
   ${MLT_BINARIES} \
   ${FFMPEG_BINARIES} \
-  -qmldir=$DEPS_INSTALL_PREFIX/qml \
+  -qmldir=$KRITA_SOURCES/plugins/dockers/textproperties \
   -verbose=2 \
   -bundle-non-qt-libs \
   -extra-plugins=$EXTRA_PLUGINS_LIST \
diff --git a/packaging/macos/osxdeploy.sh b/packaging/macos/osxdeploy.sh
index 59faf24e371..09594def4fc 100755
--- a/packaging/macos/osxdeploy.sh
+++ b/packaging/macos/osxdeploy.sh
@@ -598,7 +598,7 @@ run_macdeployqt() {
         -verbose=0 \
         -executable=${KRITA_DMG}/krita.app/Contents/MacOS/krita \
         -libpath=${KIS_INSTALL_DIR}/lib \
-        -qmldir=${KIS_INSTALL_DIR}/qml \
+        -qmldir=${KIS_SRC_DIR}/plugins/dockers/textproperties \
         -appstore-compliant
         # -extra-plugins=${KIS_INSTALL_DIR}/lib/kritaplugins \
         # -extra-plugins=${KIS_INSTALL_DIR}/lib/plugins \
@@ -685,9 +685,6 @@ krita_deploy () {
     echo "Copying mandatory libs..."
     rsync -priul ${KIS_INSTALL_DIR}/lib/libKF5* ${KIS_INSTALL_DIR}/lib/libkrita* Frameworks/
 
-    echo "Copying qml..."
-    rsync -prul ${KIS_INSTALL_DIR}/qml/ Resources/qml
-
     echo "Copying plugins..."
     local KRITA_DMG_PLUGIN_DIR="${KRITA_DMG}/krita.app/Contents/PlugIns"
     # exclude kritaquicklook.qlgenerator/
diff --git a/packaging/windows/package-complete.py b/packaging/windows/package-complete.py
index dd33e8c36e5..97d8366f62a 100644
--- a/packaging/windows/package-complete.py
+++ b/packaging/windows/package-complete.py
@@ -535,19 +535,41 @@ shutil.copy(
 shutil.copy(
     f"{KRITA_SRC_DIR}\\packaging\\windows\\krita-animation.lnk", pkg_root)
 
-QMLDIR_ARGS = ["--qmldir", f"{DEPS_INSTALL_DIR}\\qml"]
-if os.path.isdir(f"{KRITA_INSTALL_DIR}\\lib\\qml"):
-    subprocess.run(["xcopy", "/S", "/Y", "/I",
-                   f"{KRITA_INSTALL_DIR}\\lib\\qml", f"{pkg_root}\\bin\\"], check=True)
-    # This doesn't really seem to do anything
-    QMLDIR_ARGS.extend(["--qmldir", f"{KRITA_INSTALL_DIR}\\lib\\qml"])
-
-# For some reason windowsdeployqt skips installing Layouts QML plugin,
-# so we need to copy it manually
-if os.path.isdir(fr"{DEPS_INSTALL_DIR}\qml\QtQuick\Layouts"):
-    subprocess.run(["xcopy", "/S", "/Y", "/I", "{}\\qml\\QtQuick\\Layouts".format(
-        DEPS_INSTALL_DIR), fr"{pkg_root}\bin\QtQuick\Layouts"], check=True)
-
+# QML deployment:
+#
+# When deploying QML modules we should pass windeployqt all the folders
+# **in the source tree** where our resource-embedded .qml files are situated.
+# Every such folder should be declared with --qmldir option. These files will
+# **not** be deployed (because they are expected to be stored as binary resources),
+# but all their dependencies will be deployed to the package folder.
+#
+# Multiple QML dependencies search paths can be provided by --qmlimport switch,
+# we don't pass it explicitly and let it be deduced by windeployqt using qtpath
+# executable.
+
+# Here we should list all the folders/plugins in Krita that have
+# .qml files inside. Theoretically, we can just pass the entire Krita's
+# source tree, but I'm not sure it is a good idea.
+QMLDIR_ARGS = ["--qmldir", fr"{KRITA_SRC_DIR}\plugins\dockers\textproperties"]
+
+# A safeguard for the case when KDE_INSTALL_USE_QT_SYS_PATHS is not properly 
+# activated on Windows and the QML modules are installed into a default KDE's
+# location instead of the one returned by qtpath. If you see this error you 
+# should either recreate your build tree, or pass -DKDE_INSTALL_USE_QT_SYS_PATHS=ON
+# to the build or check if you have non-standard qt.conf in your installation 
+# root.
+
+if os.path.isdir(fr"{KRITA_INSTALL_DIR}\lib\qml"):
+    print("ERROR: some of Krita's QML modules were installed in an incorrect location")
+    print(fr"    actual path: {KRITA_INSTALL_DIR}\lib\qml")
+    print(fr"    expected path: {KRITA_INSTALL_DIR}\qml")
+    exit(103)
+
+if os.path.isdir(fr"{DEPS_INSTALL_DIR}\lib\qml"):
+    print("ERROR: some of Deps' QML modules were installed in an incorrect location")
+    print(fr"    actual path: {DEPS_INSTALL_DIR}\lib\qml")
+    print(fr"    expected path: {DEPS_INSTALL_DIR}\qml")
+    exit(103)
 
 # windeployqt
 if useQt6Build:



More information about the kimageshop mailing list