|
@ -42,6 +42,7 @@ |
|
|
#include <QJsonArray> |
|
|
#include <QJsonArray> |
|
|
#include <QJsonValue> |
|
|
#include <QJsonValue> |
|
|
#include <QRegularExpression> |
|
|
#include <QRegularExpression> |
|
|
|
|
|
#include <QStandardPaths> |
|
|
#include "shared.h" |
|
|
#include "shared.h" |
|
|
|
|
|
|
|
|
QString appBinaryPath; |
|
|
QString appBinaryPath; |
|
@ -181,7 +182,9 @@ LddInfo findDependencyInfo(const QString &binaryPath) |
|
|
foreach (QString outputLine, outputLines) { |
|
|
foreach (QString outputLine, outputLines) { |
|
|
// LogDebug() << "ldd outputLine:" << outputLine;
|
|
|
// LogDebug() << "ldd outputLine:" << outputLine;
|
|
|
if (outputLine.contains("not found")){ |
|
|
if (outputLine.contains("not found")){ |
|
|
LogError() << "ldd outputLine:" << outputLine; |
|
|
LogError() << "ldd outputLine:" << outputLine.replace("\t", ""); |
|
|
|
|
|
LogError() << "Please ensure that all libraries can be found by ldd. Aborting."; |
|
|
|
|
|
exit(1); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -885,9 +888,48 @@ DeploymentInfo deployQtLibraries(const QString &appDirPath, const QStringList &a |
|
|
applicationBundle.binaryPath = appBinaryPath; |
|
|
applicationBundle.binaryPath = appBinaryPath; |
|
|
LogDebug() << "applicationBundle.binaryPath:" << applicationBundle.binaryPath; |
|
|
LogDebug() << "applicationBundle.binaryPath:" << applicationBundle.binaryPath; |
|
|
|
|
|
|
|
|
|
|
|
// Find out whether Qt is a dependency of the application to be bundled
|
|
|
|
|
|
int qtDetected = 0; |
|
|
|
|
|
LddInfo lddInfo = findDependencyInfo(appBinaryPath); |
|
|
|
|
|
foreach (const DylibInfo dep, lddInfo.dependencies) { |
|
|
|
|
|
LogDebug() << "dep.binaryPath" << dep.binaryPath; |
|
|
|
|
|
if(dep.binaryPath.contains("libQt5")){ |
|
|
|
|
|
qtDetected = 5; |
|
|
|
|
|
} |
|
|
|
|
|
if(dep.binaryPath.contains("libQtCore.so.4")){ |
|
|
|
|
|
qtDetected = 4; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(qtDetected != 0){ |
|
|
|
|
|
|
|
|
// Determine the location of the Qt to be bundled
|
|
|
// Determine the location of the Qt to be bundled
|
|
|
LogDebug() << "Using qmake to determine the location of the Qt to be bundled"; |
|
|
LogDebug() << "Using qmake to determine the location of the Qt to be bundled"; |
|
|
QString output = captureOutput("qmake -query"); |
|
|
|
|
|
|
|
|
QString qmakePath = ""; |
|
|
|
|
|
|
|
|
|
|
|
// The upstream name of the binary is "qmake", for Qt 4 and Qt 5
|
|
|
|
|
|
qmakePath = QStandardPaths::findExecutable("qmake"); |
|
|
|
|
|
|
|
|
|
|
|
// But openSUSE has qmake for Qt 4 and qmake-qt5 for Qt 5
|
|
|
|
|
|
// Qt 4 on Fedora comes with suffix -qt4
|
|
|
|
|
|
// http://www.geopsy.org/wiki/index.php/Installing_Qt_binary_packages
|
|
|
|
|
|
if(qmakePath == ""){ |
|
|
|
|
|
if(qtDetected == 5){ |
|
|
|
|
|
qmakePath = QStandardPaths::findExecutable("qmake-qt5"); |
|
|
|
|
|
} |
|
|
|
|
|
if(qtDetected == 4){ |
|
|
|
|
|
qmakePath = QStandardPaths::findExecutable("qmake-qt4"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(qmakePath == ""){ |
|
|
|
|
|
LogError() << "qmake not found on the $PATH"; |
|
|
|
|
|
exit(1); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QString output = captureOutput(qmakePath + " -query"); |
|
|
|
|
|
|
|
|
QStringList outputLines = output.split("\n", QString::SkipEmptyParts); |
|
|
QStringList outputLines = output.split("\n", QString::SkipEmptyParts); |
|
|
foreach (const QString &outputLine, outputLines) { |
|
|
foreach (const QString &outputLine, outputLines) { |
|
|
int colonIndex = outputLine.indexOf(QLatin1Char(':')); |
|
|
int colonIndex = outputLine.indexOf(QLatin1Char(':')); |
|
@ -904,6 +946,7 @@ DeploymentInfo deployQtLibraries(const QString &appDirPath, const QStringList &a |
|
|
LogError() << "Qt path could not be determined from qmake on the $PATH"; |
|
|
LogError() << "Qt path could not be determined from qmake on the $PATH"; |
|
|
LogError() << "Make sure you have the correct Qt on your $PATH"; |
|
|
LogError() << "Make sure you have the correct Qt on your $PATH"; |
|
|
LogError() << "You can check this with qmake -v"; |
|
|
LogError() << "You can check this with qmake -v"; |
|
|
|
|
|
exit(1); |
|
|
} else { |
|
|
} else { |
|
|
LogDebug() << "Qt libs path determined from qmake:" << qtLibsPath; |
|
|
LogDebug() << "Qt libs path determined from qmake:" << qtLibsPath; |
|
|
QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); |
|
|
QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); |
|
@ -913,6 +956,7 @@ DeploymentInfo deployQtLibraries(const QString &appDirPath, const QStringList &a |
|
|
LogDebug() << "Changed LD_LIBRARY_PATH:" << newPath; |
|
|
LogDebug() << "Changed LD_LIBRARY_PATH:" << newPath; |
|
|
setenv("LD_LIBRARY_PATH",newPath.toUtf8().constData(),1); |
|
|
setenv("LD_LIBRARY_PATH",newPath.toUtf8().constData(),1); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if(fhsLikeMode == false){ |
|
|
if(fhsLikeMode == false){ |
|
|
changeIdentification("$ORIGIN/lib/" + bundleLibraryDirectory, QFileInfo(applicationBundle.binaryPath).canonicalFilePath()); |
|
|
changeIdentification("$ORIGIN/lib/" + bundleLibraryDirectory, QFileInfo(applicationBundle.binaryPath).canonicalFilePath()); |
|
|