Android: fix manual deployment with ANDROID_DEPLOYMENT_DEPENDENCIES

Fix the qtforandroid (i.e. libplugins_platforms_qtforandroid) check
and avoid calling llvm-readobj on non-library files and only add them
to the dependency list.

Task-number: QTBUG-94232
Pick-to: 6.2 6.5
Change-Id: Id1a415b6d9834daaf5337e9bd15e7daf69fd574f
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
This commit is contained in:
Assam Boudjelthia 2023-03-21 21:22:13 +02:00
parent b92854aed3
commit 4521dfe75a

View File

@ -1240,13 +1240,25 @@ bool readInputFile(Options *options)
} }
} }
} else { } else {
auto qtDependency = [options](const QStringView &dependency,
const QString &arch) {
const auto installDir = options->architectures[arch].qtInstallDirectory;
const auto absolutePath = "%1/%2"_L1.arg(installDir, dependency.toString());
return QtDependency(dependency.toString(), absolutePath);
};
if (dependency.endsWith(QLatin1String(".so"))) {
auto arch = fileArchitecture(*options, path); auto arch = fileArchitecture(*options, path);
if (!arch.isEmpty()) { if (!arch.isEmpty()) {
options->qtDependencies[arch].append(QtDependency(dependency.toString(), path)); options->qtDependencies[arch].append(qtDependency(dependency, arch));
} else if (options->verbose) { } else if (options->verbose) {
fprintf(stderr, "Skipping \"%s\", unknown architecture\n", qPrintable(path)); fprintf(stderr, "Skipping \"%s\", unknown architecture\n", qPrintable(path));
fflush(stderr); fflush(stderr);
} }
} else {
for (auto arch : options->architectures.keys())
options->qtDependencies[arch].append(qtDependency(dependency, arch));
}
} }
} }
} }
@ -1591,7 +1603,7 @@ bool updateLibsXml(Options *options)
if (localLibs.isEmpty()) { if (localLibs.isEmpty()) {
QString plugin; QString plugin;
for (const QtDependency &qtDependency : options->qtDependencies[it.key()]) { for (const QtDependency &qtDependency : options->qtDependencies[it.key()]) {
if (qtDependency.relativePath.endsWith("libqtforandroid.so"_L1)) if (qtDependency.relativePath.contains("libplugins_platforms_qtforandroid_"_L1))
plugin = qtDependency.relativePath; plugin = qtDependency.relativePath;
if (qtDependency.relativePath.contains( if (qtDependency.relativePath.contains(
@ -1604,8 +1616,8 @@ bool updateLibsXml(Options *options)
if (plugin.isEmpty()) { if (plugin.isEmpty()) {
fflush(stdout); fflush(stdout);
fprintf(stderr, "No platform plugin (libqtforandroid.so) included in " fprintf(stderr, "No platform plugin (libplugins_platforms_qtforandroid.so) included"
"the deployment. Make sure the app links to Qt Gui library.\n"); " in the deployment. Make sure the app links to Qt Gui library.\n");
fflush(stderr); fflush(stderr);
return false; return false;
} }