|
@ -144,19 +144,19 @@ bool linkFilePrintStatus(const QString &file, const QString &link) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
OtoolInfo findDependencyInfo(const QString &binaryPath) |
|
|
LddInfo findDependencyInfo(const QString &binaryPath) |
|
|
{ |
|
|
{ |
|
|
OtoolInfo info; |
|
|
LddInfo info; |
|
|
info.binaryPath = binaryPath; |
|
|
info.binaryPath = binaryPath; |
|
|
|
|
|
|
|
|
LogDebug() << "Using ldd:"; |
|
|
LogDebug() << "Using ldd:"; |
|
|
LogDebug() << " inspecting" << binaryPath; |
|
|
LogDebug() << " inspecting" << binaryPath; |
|
|
QProcess otool; |
|
|
QProcess ldd; |
|
|
otool.start("ldd", QStringList() << binaryPath); |
|
|
ldd.start("ldd", QStringList() << binaryPath); |
|
|
otool.waitForFinished(); |
|
|
ldd.waitForFinished(); |
|
|
|
|
|
|
|
|
if (otool.exitStatus() != QProcess::NormalExit || otool.exitCode() != 0) { |
|
|
if (ldd.exitStatus() != QProcess::NormalExit || ldd.exitCode() != 0) { |
|
|
LogError() << "findDependencyInfo:" << otool.readAllStandardError(); |
|
|
LogError() << "findDependencyInfo:" << ldd.readAllStandardError(); |
|
|
return info; |
|
|
return info; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -170,7 +170,7 @@ OtoolInfo findDependencyInfo(const QString &binaryPath) |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QString output = otool.readAllStandardOutput(); |
|
|
QString output = ldd.readAllStandardOutput(); |
|
|
QStringList outputLines = output.split("\n", QString::SkipEmptyParts); |
|
|
QStringList outputLines = output.split("\n", QString::SkipEmptyParts); |
|
|
if (outputLines.size() < 2) { |
|
|
if (outputLines.size() < 2) { |
|
|
if (output.contains("statically linked") == false){ |
|
|
if (output.contains("statically linked") == false){ |
|
@ -209,7 +209,7 @@ OtoolInfo findDependencyInfo(const QString &binaryPath) |
|
|
return info; |
|
|
return info; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
LibraryInfo parseOtoolLibraryLine(const QString &line, const QString &appBundlePath, const QSet<QString> &rpaths, bool useDebugLibs) |
|
|
LibraryInfo parseLddLibraryLine(const QString &line, const QString &appBundlePath, const QSet<QString> &rpaths, bool useDebugLibs) |
|
|
{ |
|
|
{ |
|
|
LibraryInfo info; |
|
|
LibraryInfo info; |
|
|
QString trimmed = line.trimmed(); |
|
|
QString trimmed = line.trimmed(); |
|
@ -358,7 +358,7 @@ QList<LibraryInfo> getQtLibraries(const QList<DylibInfo> &dependencies, const QS |
|
|
{ |
|
|
{ |
|
|
QList<LibraryInfo> libraries; |
|
|
QList<LibraryInfo> libraries; |
|
|
for (const DylibInfo &dylibInfo : dependencies) { |
|
|
for (const DylibInfo &dylibInfo : dependencies) { |
|
|
LibraryInfo info = parseOtoolLibraryLine(dylibInfo.binaryPath, appBundlePath, rpaths, useDebugLibs); |
|
|
LibraryInfo info = parseLddLibraryLine(dylibInfo.binaryPath, appBundlePath, rpaths, useDebugLibs); |
|
|
if (info.libraryName.isEmpty() == false) { |
|
|
if (info.libraryName.isEmpty() == false) { |
|
|
LogDebug() << "Adding library:"; |
|
|
LogDebug() << "Adding library:"; |
|
|
LogDebug() << info; |
|
|
LogDebug() << info; |
|
@ -373,19 +373,19 @@ QSet<QString> getBinaryRPaths(const QString &path, bool resolve = true, QString |
|
|
{ |
|
|
{ |
|
|
QSet<QString> rpaths; |
|
|
QSet<QString> rpaths; |
|
|
|
|
|
|
|
|
QProcess otool; |
|
|
QProcess ldd; |
|
|
otool.start("objdump", QStringList() << "-x" << path); |
|
|
ldd.start("objdump", QStringList() << "-x" << path); |
|
|
otool.waitForFinished(); |
|
|
ldd.waitForFinished(); |
|
|
|
|
|
|
|
|
if (otool.exitCode() != 0) { |
|
|
if (ldd.exitCode() != 0) { |
|
|
LogError() << "getBinaryRPaths:" << otool.readAllStandardError(); |
|
|
LogError() << "getBinaryRPaths:" << ldd.readAllStandardError(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (resolve && executablePath.isEmpty()) { |
|
|
if (resolve && executablePath.isEmpty()) { |
|
|
executablePath = path; |
|
|
executablePath = path; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
QString output = otool.readAllStandardOutput(); |
|
|
QString output = ldd.readAllStandardOutput(); |
|
|
QStringList outputLines = output.split("\n"); |
|
|
QStringList outputLines = output.split("\n"); |
|
|
QStringListIterator i(outputLines); |
|
|
QStringListIterator i(outputLines); |
|
|
|
|
|
|
|
@ -407,7 +407,7 @@ QSet<QString> getBinaryRPaths(const QString &path, bool resolve = true, QString |
|
|
|
|
|
|
|
|
QList<LibraryInfo> getQtLibraries(const QString &path, const QString &appBundlePath, const QSet<QString> &rpaths, bool useDebugLibs) |
|
|
QList<LibraryInfo> getQtLibraries(const QString &path, const QString &appBundlePath, const QSet<QString> &rpaths, bool useDebugLibs) |
|
|
{ |
|
|
{ |
|
|
const OtoolInfo info = findDependencyInfo(path); |
|
|
const LddInfo info = findDependencyInfo(path); |
|
|
return getQtLibraries(info.dependencies, appBundlePath, rpaths + getBinaryRPaths(path), useDebugLibs); |
|
|
return getQtLibraries(info.dependencies, appBundlePath, rpaths + getBinaryRPaths(path), useDebugLibs); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|