Browse Source

Add -show-exclude-libs

fix #270

Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
master
Patrick José Pereira 7 years ago
parent
commit
9f738288ef
  1. 148
      tools/linuxdeployqt/main.cpp

148
tools/linuxdeployqt/main.cpp

@ -62,7 +62,7 @@ int main(int argc, char **argv)
} }
} }
if (argc < 2 || (firstArgument.startsWith("-"))) { if (argc < 2) {
qInfo() << ""; qInfo() << "";
qInfo() << "Usage: linuxdeployqt <app-binary|desktop file> [options]"; qInfo() << "Usage: linuxdeployqt <app-binary|desktop file> [options]";
qInfo() << ""; qInfo() << "";
@ -82,6 +82,7 @@ int main(int argc, char **argv)
qInfo() << " -no-translations : Skip deployment of translations."; qInfo() << " -no-translations : Skip deployment of translations.";
qInfo() << " -qmake=<path> : The qmake executable to use."; qInfo() << " -qmake=<path> : The qmake executable to use.";
qInfo() << " -qmldir=<path> : Scan for QML imports in the given path."; qInfo() << " -qmldir=<path> : Scan for QML imports in the given path.";
qInfo() << " -show-exclude-libs : Print exclude libraries list.";
qInfo() << " -verbose=<0-3> : 0 = no output, 1 = error/warning (default),"; qInfo() << " -verbose=<0-3> : 0 = no output, 1 = error/warning (default),";
qInfo() << " 2 = normal, 3 = debug."; qInfo() << " 2 = normal, 3 = debug.";
qInfo() << " -version : Print version statement and exit."; qInfo() << " -version : Print version statement and exit.";
@ -212,6 +213,82 @@ int main(int argc, char **argv)
extern QStringList excludeLibs; extern QStringList excludeLibs;
extern bool copyCopyrightFiles; extern bool copyCopyrightFiles;
// Check arguments
for (int i = 1; i < argc; ++i) {
QByteArray argument = QByteArray(argv[i]);
if (!argument.startsWith("-")) {
continue;
} else if (argument == QByteArray("-no-plugins")) {
LogDebug() << "Argument found:" << argument;
plugins = false;
} else if (argument == QByteArray("-appimage")) {
LogDebug() << "Argument found:" << argument;
appimage = true;
bundleAllButCoreLibs = true;
} else if (argument == QByteArray("-no-strip")) {
LogDebug() << "Argument found:" << argument;
runStripEnabled = false;
} else if (argument == QByteArray("-bundle-non-qt-libs")) {
LogDebug() << "Argument found:" << argument;
bundleAllButCoreLibs = true;
} else if (argument.startsWith(QByteArray("-verbose"))) {
LogDebug() << "Argument found:" << argument;
int index = argument.indexOf("=");
bool ok = false;
int number = argument.mid(index+1).toInt(&ok);
if (!ok)
LogError() << "Could not parse verbose level";
else
logLevel = number;
} else if (argument.startsWith(QByteArray("-executable"))) {
LogDebug() << "Argument found:" << argument;
int index = argument.indexOf('=');
if (index == -1)
LogError() << "Missing executable path";
else
additionalExecutables << argument.mid(index+1);
} else if (argument.startsWith(QByteArray("-qmldir"))) {
LogDebug() << "Argument found:" << argument;
qmldirArgumentUsed = true;
int index = argument.indexOf('=');
if (index == -1)
LogError() << "Missing qml directory path";
else
qmlDirs << argument.mid(index+1);
} else if (argument.startsWith("-no-copy-copyright-files")) {
LogDebug() << "Argument found:" << argument;
copyCopyrightFiles = false;
} else if (argument == QByteArray("-always-overwrite")) {
LogDebug() << "Argument found:" << argument;
alwaysOwerwriteEnabled = true;
} else if (argument.startsWith("-qmake=")) {
LogDebug() << "Argument found:" << argument;
int index = argument.indexOf("=");
qmakeExecutable = argument.mid(index+1);
} else if (argument == QByteArray("-no-translations")) {
LogDebug() << "Argument found:" << argument;
skipTranslations = true;
} else if (argument.startsWith("-extra-plugins=")) {
LogDebug() << "Argument found:" << argument;
int index = argument.indexOf("=");
extraQtPlugins = QString(argument.mid(index + 1)).split(",");
} else if (argument.startsWith("-exclude-libs=")) {
LogDebug() << "Argument found:" << argument;
int index = argument.indexOf("=");
excludeLibs = QString(argument.mid(index + 1)).split(",");
} else if (argument == QByteArray("-show-exclude-libs")) {
qInfo() << EXCLUDELIST;
return 0;
} else if (argument.startsWith("--")) {
LogError() << "Error: arguments must not start with --, only -:" << argument << "\n";
return 1;
} else {
LogError() << "Unknown argument:" << argument << "\n";
return 1;
}
}
/* FHS-like mode is for an application that has been installed to a $PREFIX which is otherwise empty, e.g., /path/to/usr. /* FHS-like mode is for an application that has been installed to a $PREFIX which is otherwise empty, e.g., /path/to/usr.
* In this case, we want to construct an AppDir in /path/to. */ * In this case, we want to construct an AppDir in /path/to. */
if (QDir().exists((QDir::cleanPath(appBinaryPath + "/../../bin"))) == true) { if (QDir().exists((QDir::cleanPath(appBinaryPath + "/../../bin"))) == true) {
@ -363,75 +440,6 @@ int main(int argc, char **argv)
} }
} }
for (int i = 2; i < argc; ++i) {
QByteArray argument = QByteArray(argv[i]);
if (argument == QByteArray("-no-plugins")) {
LogDebug() << "Argument found:" << argument;
plugins = false;
} else if (argument == QByteArray("-appimage")) {
LogDebug() << "Argument found:" << argument;
appimage = true;
bundleAllButCoreLibs = true;
} else if (argument == QByteArray("-no-strip")) {
LogDebug() << "Argument found:" << argument;
runStripEnabled = false;
} else if (argument == QByteArray("-bundle-non-qt-libs")) {
LogDebug() << "Argument found:" << argument;
bundleAllButCoreLibs = true;
} else if (argument.startsWith(QByteArray("-verbose"))) {
LogDebug() << "Argument found:" << argument;
int index = argument.indexOf("=");
bool ok = false;
int number = argument.mid(index+1).toInt(&ok);
if (!ok)
LogError() << "Could not parse verbose level";
else
logLevel = number;
} else if (argument.startsWith(QByteArray("-executable"))) {
LogDebug() << "Argument found:" << argument;
int index = argument.indexOf('=');
if (index == -1)
LogError() << "Missing executable path";
else
additionalExecutables << argument.mid(index+1);
} else if (argument.startsWith(QByteArray("-qmldir"))) {
LogDebug() << "Argument found:" << argument;
qmldirArgumentUsed = true;
int index = argument.indexOf('=');
if (index == -1)
LogError() << "Missing qml directory path";
else
qmlDirs << argument.mid(index+1);
} else if (argument.startsWith("-no-copy-copyright-files")) {
LogDebug() << "Argument found:" << argument;
copyCopyrightFiles = false;
} else if (argument == QByteArray("-always-overwrite")) {
LogDebug() << "Argument found:" << argument;
alwaysOwerwriteEnabled = true;
} else if (argument.startsWith("-qmake=")) {
LogDebug() << "Argument found:" << argument;
int index = argument.indexOf("=");
qmakeExecutable = argument.mid(index+1);
} else if (argument == QByteArray("-no-translations")) {
LogDebug() << "Argument found:" << argument;
skipTranslations = true;
} else if (argument.startsWith("-extra-plugins=")) {
LogDebug() << "Argument found:" << argument;
int index = argument.indexOf("=");
extraQtPlugins = QString(argument.mid(index + 1)).split(",");
} else if (argument.startsWith("-exclude-libs=")) {
LogDebug() << "Argument found:" << argument;
int index = argument.indexOf("=");
excludeLibs = QString(argument.mid(index + 1)).split(",");
} else if (argument.startsWith("--")) {
LogError() << "Error: arguments must not start with --, only -:" << argument << "\n";
return 1;
} else {
LogError() << "Unknown argument:" << argument << "\n";
return 1;
}
}
if (appimage) { if (appimage) {
if(checkAppImagePrerequisites(appDirPath) == false){ if(checkAppImagePrerequisites(appDirPath) == false){
LogError() << "checkAppImagePrerequisites failed\n"; LogError() << "checkAppImagePrerequisites failed\n";

Loading…
Cancel
Save