From c04b3c0564f726f4ff2f1c5d714bfdf47987ca76 Mon Sep 17 00:00:00 2001 From: tsteven4 Date: Sun, 13 May 2018 13:46:05 -0600 Subject: [PATCH] add ability to exclude libs from a user specified list of folders. --- tools/linuxdeployqt/main.cpp | 7 +++++++ tools/linuxdeployqt/shared.cpp | 6 ++++++ tools/linuxdeployqt/shared.h | 1 + 3 files changed, 14 insertions(+) diff --git a/tools/linuxdeployqt/main.cpp b/tools/linuxdeployqt/main.cpp index 04bb1242..db22aa87 100644 --- a/tools/linuxdeployqt/main.cpp +++ b/tools/linuxdeployqt/main.cpp @@ -77,6 +77,8 @@ int main(int argc, char **argv) qInfo() << " -bundle-non-qt-libs : Also bundle non-core, non-Qt libraries."; qInfo() << " -exclude-libs= : List of libraries which should be excluded,"; qInfo() << " separated by comma."; + qInfo() << " -exclude-folders= : Excludes all libs in any folder (or subfolder)"; + qInfo() << " in the comma separated list."; qInfo() << " -executable= : Let the given executable use the deployed libraries"; qInfo() << " too"; qInfo() << " -extra-plugins= : List of extra plugins which should be deployed,"; @@ -216,6 +218,7 @@ int main(int argc, char **argv) QString qmakeExecutable; extern QStringList extraQtPlugins; extern QStringList excludeLibs; + extern QStringList blockedFolders; extern bool copyCopyrightFiles; /* FHS-like mode is for an application that has been installed to a $PREFIX which is otherwise empty, e.g., /path/to/usr. @@ -431,6 +434,10 @@ int main(int argc, char **argv) LogDebug() << "Argument found:" << argument; int index = argument.indexOf("="); excludeLibs = QString(argument.mid(index + 1)).split(","); + } else if (argument.startsWith("-exclude-folders=")) { + LogDebug() << "Argument found:" << argument; + int index = argument.indexOf("="); + blockedFolders = QString(argument.mid(index + 1)).split(","); } else if (argument.startsWith("--")) { LogError() << "Error: arguments must not start with --, only -:" << argument << "\n"; return 1; diff --git a/tools/linuxdeployqt/shared.cpp b/tools/linuxdeployqt/shared.cpp index 1029eb52..9804c8e2 100644 --- a/tools/linuxdeployqt/shared.cpp +++ b/tools/linuxdeployqt/shared.cpp @@ -60,6 +60,7 @@ bool qtDetectionComplete = 0; // As long as Qt is not detected yet, ldd may enco bool deployLibrary = false; QStringList extraQtPlugins; QStringList excludeLibs; +QStringList blockedFolders; bool copyCopyrightFiles = true; using std::cout; @@ -464,6 +465,11 @@ LibraryInfo parseLddLibraryLine(const QString &line, const QString &appDirPath, if ((trimmed.startsWith("/usr") or (trimmed.startsWith("/lib")))) { return info; } + for (int i = 0; i < blockedFolders.size(); ++i) { + if (trimmed.startsWith(blockedFolders.at(i))) { + return info; + } + } } } diff --git a/tools/linuxdeployqt/shared.h b/tools/linuxdeployqt/shared.h index 5c07bcb7..18211313 100644 --- a/tools/linuxdeployqt/shared.h +++ b/tools/linuxdeployqt/shared.h @@ -47,6 +47,7 @@ extern bool fhsLikeMode; extern QString fhsPrefix; extern QStringList extraQtPlugins; extern QStringList excludeLibs; +extern QStringList blockedFolders; class LibraryInfo {