Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.
C++
Fix deployment of QML files on three platforms
Dmitry Kazakov09cb81ceaaf9
diff --git a/packaging/linux/appimage/build-image.sh b/packaging/linux/appimage/build-image.shindex 2be41c000b..366101d62a 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/lcp -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-7cp -r $DEPS_INSTALL_PREFIX/lib/mlt-7 $APPDIR/usr/lib/mlt-7@@ -253,12 +241,24 @@ if [[ -d "$APPDIR/usr/lib/$TRIPLET" ]] ; thenrm -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 103fi# 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.shindex 59faf24e37..09594def4f 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.pyindex dd33e8c36e..97d8366f62 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)# windeployqtif useQt6Build: