diff --git a/README.md b/README.md index 79cc2dc..3023627 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,8 @@ Options: -bundle-non-qt-libs : Also bundle non-core, non-Qt libraries. -exclude-libs= : List of libraries which should be excluded, separated by comma. + -ignore-glob= : Glob pattern relative to appdir to ignore when + searching for libraries. -executable= : Let the given executable use the deployed libraries too -extra-plugins= : List of extra plugins which should be deployed, diff --git a/tools/linuxdeployqt/main.cpp b/tools/linuxdeployqt/main.cpp index 04bb124..19269d5 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() << " -ignore-glob= : Glob pattern relative to appdir to ignore when"; + qInfo() << " searching for libraries."; 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 ignoreGlob; 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("-ignore-glob=")) { + LogDebug() << "Argument found:" << argument; + int index = argument.indexOf("="); + ignoreGlob += argument.mid(index + 1); } 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 fb0c1a8..b67b11c 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 ignoreGlob; bool copyCopyrightFiles = true; using std::cout; @@ -542,23 +543,26 @@ LibraryInfo parseLddLibraryLine(const QString &line, const QString &appDirPath, QStringList findAppLibraries(const QString &appDirPath) { + QStringList ignoreGlobAbs; + QDir appDir(appDirPath); + foreach (const QString &glob, ignoreGlob) { + QString globAbs = appDir.filePath(glob); + LogDebug() << "Ignoring libraries matching" << globAbs; + ignoreGlobAbs += globAbs; + } + QStringList result; - // .so - QDirIterator iter(appDirPath, QStringList() << QString::fromLatin1("*.so"), + // .so, .so.* + QDirIterator iter(appDirPath, QStringList() << QString::fromLatin1("*.so") << QString::fromLatin1("*.so.*"), QDir::Files, QDirIterator::Subdirectories); while (iter.hasNext()) { iter.next(); + if (QDir::match(ignoreGlobAbs, iter.fileInfo().absoluteFilePath())) { + continue; + } result << iter.fileInfo().filePath(); } - // .so.*, FIXME: Is the above really needed or is it covered by the below too? - QDirIterator iter2(appDirPath, QStringList() << QString::fromLatin1("*.so*"), - QDir::Files, QDirIterator::Subdirectories); - - while (iter2.hasNext()) { - iter2.next(); - result << iter2.fileInfo().filePath(); - } return result; }