summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2018-08-29 10:28:01 +0200
committerAndy Shaw <andy.shaw@qt.io>2018-09-03 10:24:23 +0000
commita2a0ff8676bce46ed1ae7c387cbcd2f5377a0e01 (patch)
tree47dc56914fa85566c9a0bb9964241c88e79a96e2
parent6edf63144df8662bb3ff787553b183584a533f56 (diff)
downloadqttools-a2a0ff8676bce46ed1ae7c387cbcd2f5377a0e01.tar.gz
macdeployqt: Deploy plugins when -no-framework is used
When it was detecting the plugins to deploy, it would only work when Qt was configured as frameworks. This ensures that this case is accounted for. [ChangeLog][macdeployqt] Now deploys plugins when Qt is configured with -no-framework Fixes: 5.11.3 Fixes: 5.12.0 Task-number: QTBUG-68823 Change-Id: I05997150328a93c15609abc1759846b7a184f82a Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
-rw-r--r--src/macdeployqt/shared/shared.cpp45
-rw-r--r--src/macdeployqt/shared/shared.h1
2 files changed, 30 insertions, 16 deletions
diff --git a/src/macdeployqt/shared/shared.cpp b/src/macdeployqt/shared/shared.cpp
index bef3543dc..e4ec8c9a1 100644
--- a/src/macdeployqt/shared/shared.cpp
+++ b/src/macdeployqt/shared/shared.cpp
@@ -493,7 +493,7 @@ QString resolveDyldPrefix(const QString &path, const QString &loaderPath, const
return QDir::cleanPath(QDir::currentPath() + "/" +
QFileInfo(executablePath).path() + path.mid(QStringLiteral("@executable_path").length()));
}
- } else if (path.startsWith(QStringLiteral("@loader_path/"))) {
+ } else if (path.startsWith(QStringLiteral("@loader_path"))) {
// path relative to loader dir
if (QDir::isAbsolutePath(loaderPath)) {
return QDir::cleanPath(QFileInfo(loaderPath).path() + path.mid(QStringLiteral("@loader_path").length()));
@@ -906,6 +906,19 @@ void stripAppBinary(const QString &bundlePath)
runStrip(findAppBinary(bundlePath));
}
+bool DeploymentInfo::containsModule(const QString &module, const QString &libInFix) const
+{
+ // Check for framework first
+ if (deployedFrameworks.contains(QLatin1String("Qt") + module + libInFix +
+ QLatin1String(".framework"))) {
+ return true;
+ }
+ // Check for dylib
+ const QRegularExpression dylibRegExp(QLatin1String("libQt[0-9]+") + module +
+ libInFix + QLatin1String(".[0-9]+.dylib"));
+ return deployedFrameworks.filter(dylibRegExp).size() > 0;
+}
+
/*
Deploys the the listed frameworks listed into an app bundle.
The frameworks are searched for dependencies, which are also deployed.
@@ -1006,7 +1019,7 @@ QString getLibInfix(const QStringList &deployedFrameworks)
{
QString libInfix;
foreach (const QString &framework, deployedFrameworks) {
- if (framework.startsWith(QStringLiteral("QtCore"))) {
+ if (framework.startsWith(QStringLiteral("QtCore")) && framework.endsWith(QStringLiteral(".framework"))) {
Q_ASSERT(framework.length() >= 16);
// 16 == "QtCore" + ".framework"
const int lengthOfLibInfix = framework.length() - 16;
@@ -1049,14 +1062,14 @@ void deployPlugins(const ApplicationBundleInfo &appBundleInfo, const QString &pl
addPlugins(QStringLiteral("styles"));
// Check if Qt was configured with -libinfix
- const QString libInfixWithFramework = getLibInfix(deploymentInfo.deployedFrameworks) + QStringLiteral(".framework");
+ const QString libInfix = getLibInfix(deploymentInfo.deployedFrameworks);
// Network
- if (deploymentInfo.deployedFrameworks.contains(QStringLiteral("QtNetwork") + libInfixWithFramework))
+ if (deploymentInfo.containsModule("Network", libInfix))
addPlugins(QStringLiteral("bearer"));
- // All image formats (svg if QtSvg.framework is used)
- const bool usesSvg = deploymentInfo.deployedFrameworks.contains(QStringLiteral("QtSvg") + libInfixWithFramework);
+ // All image formats (svg if QtSvg is used)
+ const bool usesSvg = deploymentInfo.containsModule("Svg", libInfix);
addPlugins(QStringLiteral("imageformats"), [usesSvg](const QString &lib) {
if (lib.contains(QStringLiteral("qsvg")) && !usesSvg)
return false;
@@ -1065,8 +1078,8 @@ void deployPlugins(const ApplicationBundleInfo &appBundleInfo, const QString &pl
addPlugins(QStringLiteral("iconengines"));
- // Sql plugins if QtSql.framework is in use
- if (deploymentInfo.deployedFrameworks.contains(QStringLiteral("QtSql") + libInfixWithFramework)) {
+ // Sql plugins if QtSql is in use
+ if (deploymentInfo.containsModule("Sql", libInfix)) {
addPlugins(QStringLiteral("sqldrivers"), [](const QString &lib) {
if (lib.startsWith(QStringLiteral("libqsqlodbc")) || lib.startsWith(QStringLiteral("libqsqlpsql"))) {
LogWarning() << "Plugin" << lib << "uses private API and is not Mac App store compliant.";
@@ -1079,8 +1092,8 @@ void deployPlugins(const ApplicationBundleInfo &appBundleInfo, const QString &pl
});
}
- // WebView plugins if QtWebView.framework is in use
- if (deploymentInfo.deployedFrameworks.contains(QStringLiteral("QtWebView") + libInfixWithFramework)) {
+ // WebView plugins if QtWebView is in use
+ if (deploymentInfo.containsModule("WebView", libInfix)) {
addPlugins(QStringLiteral("webview"), [](const QString &lib) {
if (lib.startsWith(QStringLiteral("libqtwebview_webengine"))) {
LogWarning() << "Plugin" << lib << "uses QtWebEngine and is not Mac App store compliant.";
@@ -1094,15 +1107,15 @@ void deployPlugins(const ApplicationBundleInfo &appBundleInfo, const QString &pl
}
static const std::map<QString, std::vector<QString>> map {
- {QStringLiteral("QtMultimedia"), {QStringLiteral("mediaservice"), QStringLiteral("audio")}},
- {QStringLiteral("Qt3DRender"), {QStringLiteral("sceneparsers"), QStringLiteral("geometryloaders")}},
- {QStringLiteral("Qt3DQuickRender"), {QStringLiteral("renderplugins")}},
- {QStringLiteral("QtPositioning"), {QStringLiteral("position")}},
- {QStringLiteral("QtLocation"), {QStringLiteral("geoservices")}}
+ {QStringLiteral("Multimedia"), {QStringLiteral("mediaservice"), QStringLiteral("audio")}},
+ {QStringLiteral("3DRender"), {QStringLiteral("sceneparsers"), QStringLiteral("geometryloaders")}},
+ {QStringLiteral("3DQuickRender"), {QStringLiteral("renderplugins")}},
+ {QStringLiteral("Positioning"), {QStringLiteral("position")}},
+ {QStringLiteral("Location"), {QStringLiteral("geoservices")}}
};
for (const auto &it : map) {
- if (deploymentInfo.deployedFrameworks.contains(it.first + libInfixWithFramework)) {
+ if (deploymentInfo.containsModule(it.first, libInfix)) {
for (const auto &pluginType : it.second) {
addPlugins(pluginType);
}
diff --git a/src/macdeployqt/shared/shared.h b/src/macdeployqt/shared/shared.h
index c4d60ea0a..56a440917 100644
--- a/src/macdeployqt/shared/shared.h
+++ b/src/macdeployqt/shared/shared.h
@@ -99,6 +99,7 @@ public:
QSet<QString> rpathsUsed;
bool useLoaderPath;
bool isFramework;
+ bool containsModule(const QString &module, const QString &libInFix) const;
};
inline QDebug operator<<(QDebug debug, const ApplicationBundleInfo &info);