diff options
author | BogDan Vatra <bogdan@kde.org> | 2019-09-17 09:56:14 +0300 |
---|---|---|
committer | BogDan Vatra <bogdan@kde.org> | 2019-10-01 11:36:24 +0300 |
commit | fcb78b500076bf3917e5d8bf8507395bbc33a1a5 (patch) | |
tree | 2f9a7d0d94e9cebfcfd6f42c5cf49ccb07d39ba4 /src/tools | |
parent | 9e59024bf80124dbf301e8b3dca3dc4548fee428 (diff) |
Android: Fix plugins naming
Android 5 doesn't extract the files from libs folder unless they are prefixed with "lib".
This patch sets a proper name for the plugin which will make gdb happy and it will also
avoid any name clashes.
If we rename the plugins when we copy them, gdb won't find them, therefore it can't load their
symbols.
On Android all the libs are in a single folder, so to make sure we don't have any name clashes,
we are prefixing the plugin name with it's relative path to qt folder (we replace / with _).
Fixes: QTBUG-78616
Change-Id: I7e0e67d65448532769d69f46b1856c029e2cf5cb
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/androiddeployqt/main.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/tools/androiddeployqt/main.cpp b/src/tools/androiddeployqt/main.cpp index 794e3b49ae..6a32a659e6 100644 --- a/src/tools/androiddeployqt/main.cpp +++ b/src/tools/androiddeployqt/main.cpp @@ -314,10 +314,8 @@ static QString shellQuote(const QString &arg) QString architecureFromName(const QString &name) { - const QFileInfo fi(name); - const QString extractedFileName = fi.fileName(); - QRegExp architecture(QStringLiteral(".*_(.*)\\.so")); - if (!architecture.exactMatch(extractedFileName)) + QRegExp architecture(QStringLiteral(".*_(armeabi-v7a|arm64-v8a|x86|x86_64).so")); + if (!architecture.exactMatch(name)) return {}; return architecture.capturedTexts().last(); } @@ -1177,7 +1175,7 @@ bool copyAndroidExtraResources(Options *options) } else { if (!checkArchitecture(*options, originFile)) continue; - destinationFile = libsDir + QLatin1String("/lib") + QString(resourceDir.dirName() + QLatin1Char('/') + resourceFile).replace(QLatin1Char('/'), QLatin1Char('_')); + destinationFile = libsDir + resourceFile; options->archExtraPlugins[options->currentArchitecture] += resourceFile; } if (!copyFileIfNewer(originFile, destinationFile, *options)) @@ -1330,9 +1328,13 @@ bool updateLibsXml(Options *options) if (options->verbose) fprintf(stdout, " -- Using platform plugin %s\n", qPrintable(plugin)); } - allLocalLibs += QLatin1String(" <item>%1;%2</item>\n").arg(it.key(), localLibs.join(QLatin1Char(':')) - .replace(QLatin1String("lib/"), QString{}) - .replace(QLatin1Char('/'), QLatin1Char('_'))); + + // remove all paths + for (auto &lib : localLibs) { + if (lib.endsWith(QLatin1String(".so"))) + lib = lib.mid(lib.lastIndexOf(QLatin1Char('/')) + 1); + } + allLocalLibs += QLatin1String(" <item>%1;%2</item>\n").arg(it.key(), localLibs.join(QLatin1Char(':'))); } QHash<QString, QString> replacements; @@ -2033,7 +2035,7 @@ bool copyQtFiles(Options *options) if (qtDependency.relativePath.startsWith(QLatin1String("lib/"))) { garbledFileName = qtDependency.relativePath.mid(sizeof("lib/") - 1); } else { - garbledFileName = QString(qtDependency.relativePath).replace(QLatin1Char('/'), QLatin1Char('_')); + garbledFileName = qtDependency.relativePath.mid(qtDependency.relativePath.lastIndexOf(QLatin1Char('/')) + 1); } destinationFileName = libsDirectory + options->currentArchitecture + QLatin1Char('/') + garbledFileName; } else if (qtDependency.relativePath.startsWith(QLatin1String("jar/"))) { |