|
@ -235,12 +235,10 @@ FrameworkInfo parseOtoolLibraryLine(const QString &line, const QString &appBundl |
|
|
// Don't deploy low-level libraries in /lib because these tend to break if moved to a system with a different glibc.
|
|
|
// Don't deploy low-level libraries in /lib because these tend to break if moved to a system with a different glibc.
|
|
|
// TODO: Could make bundling these low-level libraries optional but then the bundles might need to
|
|
|
// TODO: Could make bundling these low-level libraries optional but then the bundles might need to
|
|
|
// use something like patchelf --set-interpreter or http://bitwagon.com/rtldi/rtldi.html
|
|
|
// use something like patchelf --set-interpreter or http://bitwagon.com/rtldi/rtldi.html
|
|
|
|
|
|
|
|
|
if (trimmed.startsWith("/lib")) |
|
|
if (trimmed.startsWith("/lib")) |
|
|
return info; |
|
|
return info; |
|
|
|
|
|
|
|
|
|
|
|
enum State {QtPath, FrameworkName, LibraryName, Version, End}; |
|
|
enum State {QtPath, FrameworkName, DylibName, Version, End}; |
|
|
|
|
|
State state = QtPath; |
|
|
State state = QtPath; |
|
|
int part = 0; |
|
|
int part = 0; |
|
|
QString name; |
|
|
QString name; |
|
@ -260,11 +258,7 @@ FrameworkInfo parseOtoolLibraryLine(const QString &line, const QString &appBundl |
|
|
if (part < parts.count() && parts.at(part).contains(".so")) { |
|
|
if (part < parts.count() && parts.at(part).contains(".so")) { |
|
|
info.frameworkDirectory += "/" + (qtPath + currentPart + "/").simplified(); |
|
|
info.frameworkDirectory += "/" + (qtPath + currentPart + "/").simplified(); |
|
|
LogDebug() << "info.frameworkDirectory:" << info.frameworkDirectory; |
|
|
LogDebug() << "info.frameworkDirectory:" << info.frameworkDirectory; |
|
|
state = DylibName; |
|
|
state = LibraryName; |
|
|
continue; |
|
|
|
|
|
} else if (part < parts.count() && parts.at(part).endsWith(".framework")) { |
|
|
|
|
|
info.frameworkDirectory += "/" + (qtPath + "lib/").simplified(); |
|
|
|
|
|
state = FrameworkName; |
|
|
|
|
|
continue; |
|
|
continue; |
|
|
} else if (trimmed.startsWith("/") == false) { // If the line does not contain a full path, the app is using a binary Qt package.
|
|
|
} else if (trimmed.startsWith("/") == false) { // If the line does not contain a full path, the app is using a binary Qt package.
|
|
|
QStringList partsCopy = parts; |
|
|
QStringList partsCopy = parts; |
|
@ -278,39 +272,17 @@ FrameworkInfo parseOtoolLibraryLine(const QString &line, const QString &appBundl |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
/*
|
|
|
if (info.frameworkDirectory.isEmpty()) |
|
|
if (currentPart.contains(".framework")) { |
|
|
info.frameworkDirectory = "/usr/lib/" + partsCopy.join("/"); |
|
|
if (info.frameworkDirectory.isEmpty()) |
|
|
if (!info.frameworkDirectory.endsWith("/")) |
|
|
info.frameworkDirectory = "/Library/Frameworks/" + partsCopy.join("/"); |
|
|
info.frameworkDirectory += "/"; |
|
|
if (!info.frameworkDirectory.endsWith("/")) |
|
|
state = LibraryName; |
|
|
info.frameworkDirectory += "/"; |
|
|
--part; |
|
|
state = FrameworkName; |
|
|
continue; |
|
|
--part; |
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|
} else if (currentPart.contains(".so")) { |
|
|
|
|
|
*/ |
|
|
|
|
|
if (info.frameworkDirectory.isEmpty()) |
|
|
|
|
|
info.frameworkDirectory = "/usr/lib/" + partsCopy.join("/"); |
|
|
|
|
|
if (!info.frameworkDirectory.endsWith("/")) |
|
|
|
|
|
info.frameworkDirectory += "/"; |
|
|
|
|
|
state = DylibName; |
|
|
|
|
|
--part; |
|
|
|
|
|
continue; |
|
|
|
|
|
// }
|
|
|
|
|
|
} |
|
|
} |
|
|
qtPath += (currentPart + "/"); |
|
|
qtPath += (currentPart + "/"); |
|
|
|
|
|
|
|
|
} if (state == FrameworkName) { |
|
|
} if (state == LibraryName) { |
|
|
// remove ".framework"
|
|
|
|
|
|
name = currentPart; |
|
|
|
|
|
name.chop(QString(".framework").length()); |
|
|
|
|
|
info.isDylib = false; |
|
|
|
|
|
info.frameworkName = currentPart; |
|
|
|
|
|
state = Version; |
|
|
|
|
|
++part; |
|
|
|
|
|
continue; |
|
|
|
|
|
} if (state == DylibName) { |
|
|
|
|
|
name = currentPart; |
|
|
name = currentPart; |
|
|
info.isDylib = true; |
|
|
info.isDylib = true; |
|
|
info.frameworkName = name; |
|
|
info.frameworkName = name; |
|
@ -438,13 +410,13 @@ QList<FrameworkInfo> getQtFrameworks(const QList<DylibInfo> &dependencies, const |
|
|
return libraries; |
|
|
return libraries; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// TODO: Switch the following to using patchelf
|
|
|
QSet<QString> getBinaryRPaths(const QString &path, bool resolve = true, QString executablePath = QString()) |
|
|
QSet<QString> getBinaryRPaths(const QString &path, bool resolve = true, QString executablePath = QString()) |
|
|
{ |
|
|
{ |
|
|
QSet<QString> rpaths; |
|
|
QSet<QString> rpaths; |
|
|
|
|
|
|
|
|
QProcess otool; |
|
|
QProcess otool; |
|
|
otool.start("patchelf", QStringList() << "--print-rpath" << path); |
|
|
otool.start("objdump", QStringList() << "-x" << path); |
|
|
otool.waitForFinished(); |
|
|
otool.waitForFinished(); |
|
|
|
|
|
|
|
|
if (otool.exitCode() != 0) { |
|
|
if (otool.exitCode() != 0) { |
|
@ -456,15 +428,20 @@ QSet<QString> getBinaryRPaths(const QString &path, bool resolve = true, QString |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
QString output = otool.readAllStandardOutput(); |
|
|
QString output = otool.readAllStandardOutput(); |
|
|
LogDebug() << "output:" << output; |
|
|
|
|
|
QStringList outputLines = output.split("\n"); |
|
|
QStringList outputLines = output.split("\n"); |
|
|
QStringListIterator i(outputLines); |
|
|
QStringListIterator i(outputLines); |
|
|
|
|
|
|
|
|
while (i.hasNext()) { |
|
|
while (i.hasNext()) { |
|
|
const QString &rpathCmd = i.next(); |
|
|
if (i.next().contains("RUNPATH") && i.hasNext()) { |
|
|
QString rpath = rpathCmd.trimmed(); |
|
|
i.previous(); |
|
|
LogDebug() << "rpath:" << rpath; |
|
|
const QString &rpathCmd = i.next(); |
|
|
rpaths << rpath; |
|
|
int pathStart = rpathCmd.indexOf("RUNPATH"); |
|
|
|
|
|
if (pathStart >= 0) { |
|
|
|
|
|
QString rpath = rpathCmd.mid(pathStart+8).trimmed(); |
|
|
|
|
|
LogDebug() << "rpath:" << rpath; |
|
|
|
|
|
rpaths << rpath; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return rpaths; |
|
|
return rpaths; |
|
|