Browse Source

Add -ignore-glob argument (#305)

master
Florian Märkl 6 years ago
committed by probonopd
parent
commit
b9b3321202
  1. 2
      README.md
  2. 7
      tools/linuxdeployqt/main.cpp
  3. 24
      tools/linuxdeployqt/shared.cpp

2
README.md

@ -29,6 +29,8 @@ Options:
-bundle-non-qt-libs : Also bundle non-core, non-Qt libraries.
-exclude-libs=<list> : List of libraries which should be excluded,
separated by comma.
-ignore-glob=<glob> : Glob pattern relative to appdir to ignore when
searching for libraries.
-executable=<path> : Let the given executable use the deployed libraries
too
-extra-plugins=<list> : List of extra plugins which should be deployed,

7
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> : List of libraries which should be excluded,";
qInfo() << " separated by comma.";
qInfo() << " -ignore-glob=<glob> : Glob pattern relative to appdir to ignore when";
qInfo() << " searching for libraries.";
qInfo() << " -executable=<path> : Let the given executable use the deployed libraries";
qInfo() << " too";
qInfo() << " -extra-plugins=<list> : 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;

24
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;
}

Loading…
Cancel
Save