Browse Source

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
master
tobtoht 3 years ago
committed by GitHub
parent
commit
66d6eeea28
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      tools/linuxdeployqt/main.cpp
  2. 19
      tools/linuxdeployqt/shared.cpp

2
tools/linuxdeployqt/main.cpp

@ -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;

19
tools/linuxdeployqt/shared.cpp

@ -32,7 +32,6 @@
#include <iostream>
#include <QProcess>
#include <QDir>
#include <QRegExp>
#include <QSet>
#include <QStack>
#include <QDirIterator>
@ -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;
@ -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(" "))){
@ -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;
@ -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)) {
@ -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) {
@ -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) {

Loading…
Cancel
Save