Go back to objdump for now; remove sections concerning macOS Frameworks
This commit is contained in:
+13
-36
@@ -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 (currentPart.contains(".framework")) {
|
|
||||||
if (info.frameworkDirectory.isEmpty())
|
|
||||||
info.frameworkDirectory = "/Library/Frameworks/" + partsCopy.join("/");
|
|
||||||
if (!info.frameworkDirectory.endsWith("/"))
|
|
||||||
info.frameworkDirectory += "/";
|
|
||||||
state = FrameworkName;
|
|
||||||
--part;
|
|
||||||
continue;
|
|
||||||
|
|
||||||
} else if (currentPart.contains(".so")) {
|
|
||||||
*/
|
|
||||||
if (info.frameworkDirectory.isEmpty())
|
if (info.frameworkDirectory.isEmpty())
|
||||||
info.frameworkDirectory = "/usr/lib/" + partsCopy.join("/");
|
info.frameworkDirectory = "/usr/lib/" + partsCopy.join("/");
|
||||||
if (!info.frameworkDirectory.endsWith("/"))
|
if (!info.frameworkDirectory.endsWith("/"))
|
||||||
info.frameworkDirectory += "/";
|
info.frameworkDirectory += "/";
|
||||||
state = DylibName;
|
state = LibraryName;
|
||||||
--part;
|
--part;
|
||||||
continue;
|
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,16 +428,21 @@ 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()) {
|
||||||
|
if (i.next().contains("RUNPATH") && i.hasNext()) {
|
||||||
|
i.previous();
|
||||||
const QString &rpathCmd = i.next();
|
const QString &rpathCmd = i.next();
|
||||||
QString rpath = rpathCmd.trimmed();
|
int pathStart = rpathCmd.indexOf("RUNPATH");
|
||||||
|
if (pathStart >= 0) {
|
||||||
|
QString rpath = rpathCmd.mid(pathStart+8).trimmed();
|
||||||
LogDebug() << "rpath:" << rpath;
|
LogDebug() << "rpath:" << rpath;
|
||||||
rpaths << rpath;
|
rpaths << rpath;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return rpaths;
|
return rpaths;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user