Skip to content

Commit 66d6eee

Browse files
authored
Allow linuxdeployqt to be built with Qt 6
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
1 parent aeafcd2 commit 66d6eee

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

tools/linuxdeployqt/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ int main(int argc, char **argv)
541541
// Update deploymentInfo.deployedLibraries - the QML imports
542542
// may have brought in extra libraries as dependencies.
543543
deploymentInfo.deployedLibraries += findAppLibraries(appDirPath);
544-
deploymentInfo.deployedLibraries = deploymentInfo.deployedLibraries.toSet().toList();
544+
deploymentInfo.deployedLibraries.removeDuplicates();
545545
}
546546

547547
deploymentInfo.usedModulesMask = 0;

tools/linuxdeployqt/shared.cpp

+14-5
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
#include <iostream>
3333
#include <QProcess>
3434
#include <QDir>
35-
#include <QRegExp>
3635
#include <QSet>
3736
#include <QStack>
3837
#include <QDirIterator>
@@ -46,6 +45,12 @@
4645
#include "shared.h"
4746
#include "excludelist.h"
4847

48+
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
49+
#define QSTRING_SPLIT_BEHAVIOR_NAMESPACE QString
50+
#else
51+
#define QSTRING_SPLIT_BEHAVIOR_NAMESPACE Qt
52+
#endif
53+
4954
QString appBinaryPath;
5055
bool runStripEnabled = true;
5156
bool bundleAllButCoreLibs = false;
@@ -307,7 +312,7 @@ bool copyCopyrightFile(QString libPath){
307312
myProcess->waitForFinished();
308313
strOut = myProcess->readAllStandardOutput();
309314

310-
QStringList outputLines = strOut.split("\n", QString::SkipEmptyParts);
315+
QStringList outputLines = strOut.split("\n", QSTRING_SPLIT_BEHAVIOR_NAMESPACE::SkipEmptyParts);
311316

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

358363
QString output = ldd.readAllStandardOutput();
359-
QStringList outputLines = output.split("\n", QString::SkipEmptyParts);
364+
QStringList outputLines = output.split("\n", QSTRING_SPLIT_BEHAVIOR_NAMESPACE::SkipEmptyParts);
360365
if (outputLines.size() < 2) {
361366
if ((output.contains("statically linked") == false)){
362367
LogError() << "Could not parse ldd output under 2 lines:" << output;
@@ -851,7 +856,7 @@ void changeIdentification(const QString &id, const QString &binaryPath)
851856
}
852857
}
853858

854-
QStringList rpath = oldRpath.split(":", QString::SkipEmptyParts);
859+
QStringList rpath = oldRpath.split(":", QSTRING_SPLIT_BEHAVIOR_NAMESPACE::SkipEmptyParts);
855860
rpath.prepend(id);
856861
rpath.removeDuplicates();
857862
foreach(QString path, QStringList(rpath)) {
@@ -1064,7 +1069,11 @@ DeploymentInfo deployQtLibraries(QList<LibraryInfo> libraries,
10641069
static QString captureOutput(const QString &command)
10651070
{
10661071
QProcess process;
1072+
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
10671073
process.start(command, QIODevice::ReadOnly);
1074+
#else
1075+
process.startCommand(command, QIODevice::ReadOnly);
1076+
#endif
10681077
process.waitForFinished();
10691078

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

1132-
QStringList outputLines = output.split("\n", QString::SkipEmptyParts);
1141+
QStringList outputLines = output.split("\n", QSTRING_SPLIT_BEHAVIOR_NAMESPACE::SkipEmptyParts);
11331142
foreach (const QString &outputLine, outputLines) {
11341143
int colonIndex = outputLine.indexOf(QLatin1Char(':'));
11351144
if (colonIndex != -1) {

0 commit comments

Comments
 (0)