include legacy pre-multiarch plugin paths
authorSteve Langasek <steve.langasek@ubuntu.com>
Mon, 14 Sep 2020 13:56:35 +0000 (14:56 +0100)
committerLisandro Damián Nicanor Pérez Meyer <lisandro@debian.org>
Mon, 14 Sep 2020 13:56:35 +0000 (14:56 +0100)
Last-Update: 2012-04-25

A full multiarch system requires an architecture-qualified plugin path for
Qt, but installed systems may still have plugins (e.g., from other
distribution packages) in another pre-multiarch directory.  When constructing
the plugin path, include both the configured plugin path and a plugin path
with the architecture triplet stripped out.

This applies to the general plugin loading system, and to the QML one.

Gbp-Pq: Name qt-multiarch-plugin-path-compat.diff

src/corelib/kernel/qcoreapplication.cpp
src/declarative/qml/qdeclarativeimport.cpp

index 83956dd83a52374fbd9f7f2501fc73a5339cf180..ab5889dc609270aa124e682c2c431b88bbbf6f71 100644 (file)
@@ -2531,6 +2531,23 @@ QStringList QCoreApplication::libraryPaths()
             if (!app_libpaths->contains(installPathPlugins))
                 app_libpaths->append(installPathPlugins);
         }
+        QString pathSep("/");
+        QStringList dirnames = QString(installPathPlugins).split(QLatin1Char('/'), QString::SkipEmptyParts);
+        if (dirnames[0] == QLatin1String("usr") && dirnames[1] == QLatin1String("lib") && dirnames[3] == QLatin1String("qt4"))
+        {
+            QString legacyPathPlugins = pathSep;
+            int i = 0;
+            for (QStringList::const_iterator it = dirnames.constBegin(); it != dirnames.constEnd(); ++it) {
+                if (++i == 3)
+                    continue;
+                legacyPathPlugins = legacyPathPlugins + QString(*it) + pathSep;
+            }
+            if (QFile::exists(legacyPathPlugins)) {
+                legacyPathPlugins = QDir(legacyPathPlugins).canonicalPath();
+                if (!app_libpaths->contains(legacyPathPlugins))
+                    app_libpaths->append(legacyPathPlugins);
+            }
+        }
 #endif
 
         // If QCoreApplication is not yet instantiated,
index 26ac527f1ba67ea30c767608341502a94b81e834..e09691e1d59826ad0b5c9efe836ac956d326e5c3 100644 (file)
@@ -770,6 +770,22 @@ QDeclarativeImportDatabase::QDeclarativeImportDatabase(QDeclarativeEngine *e)
         addImportPath(installImportsPath);
     }
 #else
+    QStringList dirnames = installImportsPath.split(QLatin1Char('/'), QString::SkipEmptyParts);
+    if (dirnames[0] == QLatin1String("usr") && dirnames[1] == QLatin1String("lib") && dirnames[3] == QLatin1String("qt4"))
+    {
+        QString pathSep("/");
+        QString legacyImportPath = pathSep;
+        int i = 0;
+        for (QStringList::const_iterator it = dirnames.constBegin(); it != dirnames.constEnd(); ++it) {
+            if (++i == 3)
+                continue;
+            legacyImportPath = legacyImportPath + *it + pathSep;
+        }
+        if (QFile::exists(legacyImportPath)) {
+            addImportPath(legacyImportPath);
+        }
+    }
+
     addImportPath(installImportsPath);
 #endif