Skip to content

Commit b9b3321

Browse files
thestr4ng3rprobonopd
authored andcommitted
Add -ignore-glob argument (probonopd#305)
1 parent ac2d5c2 commit b9b3321

File tree

3 files changed

+23
-10
lines changed

3 files changed

+23
-10
lines changed

Diff for: README.md

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ Options:
2929
-bundle-non-qt-libs : Also bundle non-core, non-Qt libraries.
3030
-exclude-libs=<list> : List of libraries which should be excluded,
3131
separated by comma.
32+
-ignore-glob=<glob> : Glob pattern relative to appdir to ignore when
33+
searching for libraries.
3234
-executable=<path> : Let the given executable use the deployed libraries
3335
too
3436
-extra-plugins=<list> : List of extra plugins which should be deployed,

Diff for: tools/linuxdeployqt/main.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ int main(int argc, char **argv)
7777
qInfo() << " -bundle-non-qt-libs : Also bundle non-core, non-Qt libraries.";
7878
qInfo() << " -exclude-libs=<list> : List of libraries which should be excluded,";
7979
qInfo() << " separated by comma.";
80+
qInfo() << " -ignore-glob=<glob> : Glob pattern relative to appdir to ignore when";
81+
qInfo() << " searching for libraries.";
8082
qInfo() << " -executable=<path> : Let the given executable use the deployed libraries";
8183
qInfo() << " too";
8284
qInfo() << " -extra-plugins=<list> : List of extra plugins which should be deployed,";
@@ -216,6 +218,7 @@ int main(int argc, char **argv)
216218
QString qmakeExecutable;
217219
extern QStringList extraQtPlugins;
218220
extern QStringList excludeLibs;
221+
extern QStringList ignoreGlob;
219222
extern bool copyCopyrightFiles;
220223

221224
/* 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)
431434
LogDebug() << "Argument found:" << argument;
432435
int index = argument.indexOf("=");
433436
excludeLibs = QString(argument.mid(index + 1)).split(",");
437+
} else if (argument.startsWith("-ignore-glob=")) {
438+
LogDebug() << "Argument found:" << argument;
439+
int index = argument.indexOf("=");
440+
ignoreGlob += argument.mid(index + 1);
434441
} else if (argument.startsWith("--")) {
435442
LogError() << "Error: arguments must not start with --, only -:" << argument << "\n";
436443
return 1;

Diff for: tools/linuxdeployqt/shared.cpp

+14-10
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ bool qtDetectionComplete = 0; // As long as Qt is not detected yet, ldd may enco
6060
bool deployLibrary = false;
6161
QStringList extraQtPlugins;
6262
QStringList excludeLibs;
63+
QStringList ignoreGlob;
6364
bool copyCopyrightFiles = true;
6465

6566
using std::cout;
@@ -542,23 +543,26 @@ LibraryInfo parseLddLibraryLine(const QString &line, const QString &appDirPath,
542543

543544
QStringList findAppLibraries(const QString &appDirPath)
544545
{
546+
QStringList ignoreGlobAbs;
547+
QDir appDir(appDirPath);
548+
foreach (const QString &glob, ignoreGlob) {
549+
QString globAbs = appDir.filePath(glob);
550+
LogDebug() << "Ignoring libraries matching" << globAbs;
551+
ignoreGlobAbs += globAbs;
552+
}
553+
545554
QStringList result;
546-
// .so
547-
QDirIterator iter(appDirPath, QStringList() << QString::fromLatin1("*.so"),
555+
// .so, .so.*
556+
QDirIterator iter(appDirPath, QStringList() << QString::fromLatin1("*.so") << QString::fromLatin1("*.so.*"),
548557
QDir::Files, QDirIterator::Subdirectories);
549558

550559
while (iter.hasNext()) {
551560
iter.next();
561+
if (QDir::match(ignoreGlobAbs, iter.fileInfo().absoluteFilePath())) {
562+
continue;
563+
}
552564
result << iter.fileInfo().filePath();
553565
}
554-
// .so.*, FIXME: Is the above really needed or is it covered by the below too?
555-
QDirIterator iter2(appDirPath, QStringList() << QString::fromLatin1("*.so*"),
556-
QDir::Files, QDirIterator::Subdirectories);
557-
558-
while (iter2.hasNext()) {
559-
iter2.next();
560-
result << iter2.fileInfo().filePath();
561-
}
562566
return result;
563567
}
564568

0 commit comments

Comments
 (0)