Skip to content

Commit

Permalink
Allow linuxdeployqt to be built with Qt 6
Browse files Browse the repository at this point in the history
Allow linuxdeployqt to be built with Qt 6; this does not mean that we build linuxdeployqt with Qt 6 or that linuxdeployqt can deploy Qt 6 applications yet

Thanks @tobtoht
  • Loading branch information
tobtoht authored May 24, 2022
1 parent aeafcd2 commit 66d6eee
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion tools/linuxdeployqt/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ int main(int argc, char **argv)
// Update deploymentInfo.deployedLibraries - the QML imports
// may have brought in extra libraries as dependencies.
deploymentInfo.deployedLibraries += findAppLibraries(appDirPath);
deploymentInfo.deployedLibraries = deploymentInfo.deployedLibraries.toSet().toList();
deploymentInfo.deployedLibraries.removeDuplicates();
}

deploymentInfo.usedModulesMask = 0;
Expand Down
19 changes: 14 additions & 5 deletions tools/linuxdeployqt/shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include <iostream>
#include <QProcess>
#include <QDir>
#include <QRegExp>
#include <QSet>
#include <QStack>
#include <QDirIterator>
Expand All @@ -46,6 +45,12 @@
#include "shared.h"
#include "excludelist.h"

#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#define QSTRING_SPLIT_BEHAVIOR_NAMESPACE QString
#else
#define QSTRING_SPLIT_BEHAVIOR_NAMESPACE Qt
#endif

QString appBinaryPath;
bool runStripEnabled = true;
bool bundleAllButCoreLibs = false;
Expand Down Expand Up @@ -307,7 +312,7 @@ bool copyCopyrightFile(QString libPath){
myProcess->waitForFinished();
strOut = myProcess->readAllStandardOutput();

QStringList outputLines = strOut.split("\n", QString::SkipEmptyParts);
QStringList outputLines = strOut.split("\n", QSTRING_SPLIT_BEHAVIOR_NAMESPACE::SkipEmptyParts);

foreach (QString outputLine, outputLines) {
if((outputLine.contains("usr/share/doc")) && (outputLine.contains("/copyright")) && (outputLine.contains(" "))){
Expand Down Expand Up @@ -356,7 +361,7 @@ LddInfo findDependencyInfo(const QString &binaryPath)
static const QRegularExpression regexp(QStringLiteral("^.+ => (.+) \\("));

QString output = ldd.readAllStandardOutput();
QStringList outputLines = output.split("\n", QString::SkipEmptyParts);
QStringList outputLines = output.split("\n", QSTRING_SPLIT_BEHAVIOR_NAMESPACE::SkipEmptyParts);
if (outputLines.size() < 2) {
if ((output.contains("statically linked") == false)){
LogError() << "Could not parse ldd output under 2 lines:" << output;
Expand Down Expand Up @@ -851,7 +856,7 @@ void changeIdentification(const QString &id, const QString &binaryPath)
}
}

QStringList rpath = oldRpath.split(":", QString::SkipEmptyParts);
QStringList rpath = oldRpath.split(":", QSTRING_SPLIT_BEHAVIOR_NAMESPACE::SkipEmptyParts);
rpath.prepend(id);
rpath.removeDuplicates();
foreach(QString path, QStringList(rpath)) {
Expand Down Expand Up @@ -1064,7 +1069,11 @@ DeploymentInfo deployQtLibraries(QList<LibraryInfo> libraries,
static QString captureOutput(const QString &command)
{
QProcess process;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
process.start(command, QIODevice::ReadOnly);
#else
process.startCommand(command, QIODevice::ReadOnly);
#endif
process.waitForFinished();

if (process.exitStatus() != QProcess::NormalExit) {
Expand Down Expand Up @@ -1129,7 +1138,7 @@ DeploymentInfo deployQtLibraries(const QString &appDirPath, const QStringList &a
QString output = captureOutput(qmakePath + " -query");
LogDebug() << "-query output from qmake:" << output;

QStringList outputLines = output.split("\n", QString::SkipEmptyParts);
QStringList outputLines = output.split("\n", QSTRING_SPLIT_BEHAVIOR_NAMESPACE::SkipEmptyParts);
foreach (const QString &outputLine, outputLines) {
int colonIndex = outputLine.indexOf(QLatin1Char(':'));
if (colonIndex != -1) {
Expand Down

0 comments on commit 66d6eee

Please sign in to comment.