status-mobile/nix/desktop/linux/linuxdeployqt/linuxdeployqt.patch

40 lines
2.4 KiB
Diff

diff --git a/tools/linuxdeployqt/shared.cpp b/tools/linuxdeployqt/shared.cpp
index 4c0919a..1a136e0 100644
--- a/tools/linuxdeployqt/shared.cpp
+++ b/tools/linuxdeployqt/shared.cpp
@@ -833,20 +833,23 @@ void changeIdentification(const QString &id, const QString &binaryPath)
LogNormal() << "Checking rpath in" << binaryPath;
QString oldRpath = runPatchelf(QStringList() << "--print-rpath" << binaryPath);
LogDebug() << "oldRpath:" << oldRpath;
- if (oldRpath.startsWith("/")){
- LogDebug() << "Old rpath in" << binaryPath << "starts with /, hence adding it to LD_LIBRARY_PATH";
- // FIXME: Split along ":" characters, check each one, only append to LD_LIBRARY_PATH if not already there
- QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
- QString oldPath = env.value("LD_LIBRARY_PATH");
- if (not oldPath.contains(oldRpath)){
- QString newPath = oldRpath + ":" + oldPath; // FIXME: If we use a ldd replacement, we still need to observe this path
- // FIXME: Directory layout might be different for system Qt; cannot assume lib/ to always be inside the Qt directory
- LogDebug() << "Added to LD_LIBRARY_PATH:" << newPath;
- setenv("LD_LIBRARY_PATH",newPath.toUtf8().constData(),1);
+
+ QStringList rpath = oldRpath.split(":", QString::SkipEmptyParts);
+ foreach(QString path, QStringList(rpath)) {
+ if (path.startsWith("/")){
+ LogDebug() << "Old rpath in" << binaryPath << "starts with /, hence adding it to LD_LIBRARY_PATH";
+ // FIXME: Split along ":" characters, check each one, only append to LD_LIBRARY_PATH if not already there
+ QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
+ QString oldPath = env.value("LD_LIBRARY_PATH");
+ if (not oldPath.contains(oldRpath)){
+ QString newPath = oldRpath + ":" + oldPath; // FIXME: If we use a ldd replacement, we still need to observe this path
+ // FIXME: Directory layout might be different for system Qt; cannot assume lib/ to always be inside the Qt directory
+ LogDebug() << "Added to LD_LIBRARY_PATH:" << newPath;
+ setenv("LD_LIBRARY_PATH",newPath.toUtf8().constData(),1);
+ }
}
}
- QStringList rpath = oldRpath.split(":", QString::SkipEmptyParts);
rpath.prepend(id);
rpath.removeDuplicates();
foreach(QString path, QStringList(rpath)) {