Skip to content

Commit 9ac2e44

Browse files
Add -show-exclude-libs
fix #270 Signed-off-by: Patrick José Pereira <[email protected]>
1 parent c1e8ce6 commit 9ac2e44

File tree

1 file changed

+75
-70
lines changed

1 file changed

+75
-70
lines changed

tools/linuxdeployqt/main.cpp

Lines changed: 75 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ int main(int argc, char **argv)
6262
}
6363
}
6464

65-
if (argc < 2 || (firstArgument.startsWith("-"))) {
65+
if (argc < 2) {
6666
qInfo() << "";
6767
qInfo() << "Usage: linuxdeployqt <app-binary|desktop file> [options]";
6868
qInfo() << "";
@@ -82,6 +82,7 @@ int main(int argc, char **argv)
8282
qInfo() << " -no-translations : Skip deployment of translations.";
8383
qInfo() << " -qmake=<path> : The qmake executable to use.";
8484
qInfo() << " -qmldir=<path> : Scan for QML imports in the given path.";
85+
qInfo() << " -show-exclude-libs : Print exclude libraries list.";
8586
qInfo() << " -verbose=<0-3> : 0 = no output, 1 = error/warning (default),";
8687
qInfo() << " 2 = normal, 3 = debug.";
8788
qInfo() << " -version : Print version statement and exit.";
@@ -212,6 +213,79 @@ int main(int argc, char **argv)
212213
extern QStringList excludeLibs;
213214
extern bool copyCopyrightFiles;
214215

216+
// Check arguments
217+
for (int i = 1; i < argc; ++i) {
218+
QByteArray argument = QByteArray(argv[i]);
219+
if (argument == QByteArray("-no-plugins")) {
220+
LogDebug() << "Argument found:" << argument;
221+
plugins = false;
222+
} else if (argument == QByteArray("-appimage")) {
223+
LogDebug() << "Argument found:" << argument;
224+
appimage = true;
225+
bundleAllButCoreLibs = true;
226+
} else if (argument == QByteArray("-no-strip")) {
227+
LogDebug() << "Argument found:" << argument;
228+
runStripEnabled = false;
229+
} else if (argument == QByteArray("-bundle-non-qt-libs")) {
230+
LogDebug() << "Argument found:" << argument;
231+
bundleAllButCoreLibs = true;
232+
} else if (argument.startsWith(QByteArray("-verbose"))) {
233+
LogDebug() << "Argument found:" << argument;
234+
int index = argument.indexOf("=");
235+
bool ok = false;
236+
int number = argument.mid(index+1).toInt(&ok);
237+
if (!ok)
238+
LogError() << "Could not parse verbose level";
239+
else
240+
logLevel = number;
241+
} else if (argument.startsWith(QByteArray("-executable"))) {
242+
LogDebug() << "Argument found:" << argument;
243+
int index = argument.indexOf('=');
244+
if (index == -1)
245+
LogError() << "Missing executable path";
246+
else
247+
additionalExecutables << argument.mid(index+1);
248+
} else if (argument.startsWith(QByteArray("-qmldir"))) {
249+
LogDebug() << "Argument found:" << argument;
250+
qmldirArgumentUsed = true;
251+
int index = argument.indexOf('=');
252+
if (index == -1)
253+
LogError() << "Missing qml directory path";
254+
else
255+
qmlDirs << argument.mid(index+1);
256+
} else if (argument.startsWith("-no-copy-copyright-files")) {
257+
LogDebug() << "Argument found:" << argument;
258+
copyCopyrightFiles = false;
259+
} else if (argument == QByteArray("-always-overwrite")) {
260+
LogDebug() << "Argument found:" << argument;
261+
alwaysOwerwriteEnabled = true;
262+
} else if (argument.startsWith("-qmake=")) {
263+
LogDebug() << "Argument found:" << argument;
264+
int index = argument.indexOf("=");
265+
qmakeExecutable = argument.mid(index+1);
266+
} else if (argument == QByteArray("-no-translations")) {
267+
LogDebug() << "Argument found:" << argument;
268+
skipTranslations = true;
269+
} else if (argument.startsWith("-extra-plugins=")) {
270+
LogDebug() << "Argument found:" << argument;
271+
int index = argument.indexOf("=");
272+
extraQtPlugins = QString(argument.mid(index + 1)).split(",");
273+
} else if (argument.startsWith("-exclude-libs=")) {
274+
LogDebug() << "Argument found:" << argument;
275+
int index = argument.indexOf("=");
276+
excludeLibs = QString(argument.mid(index + 1)).split(",");
277+
} else if (argument.startsWith("-show-exclude-libs")) {
278+
qInfo() << EXCLUDELIST;
279+
return 0;
280+
} else if (argument.startsWith("--")) {
281+
LogError() << "Error: arguments must not start with --, only -:" << argument << "\n";
282+
return 1;
283+
} else {
284+
LogError() << "Unknown argument:" << argument << "\n";
285+
return 1;
286+
}
287+
}
288+
215289
/* FHS-like mode is for an application that has been installed to a $PREFIX which is otherwise empty, e.g., /path/to/usr.
216290
* In this case, we want to construct an AppDir in /path/to. */
217291
if (QDir().exists((QDir::cleanPath(appBinaryPath + "/../../bin"))) == true) {
@@ -363,75 +437,6 @@ int main(int argc, char **argv)
363437
}
364438
}
365439

366-
for (int i = 2; i < argc; ++i) {
367-
QByteArray argument = QByteArray(argv[i]);
368-
if (argument == QByteArray("-no-plugins")) {
369-
LogDebug() << "Argument found:" << argument;
370-
plugins = false;
371-
} else if (argument == QByteArray("-appimage")) {
372-
LogDebug() << "Argument found:" << argument;
373-
appimage = true;
374-
bundleAllButCoreLibs = true;
375-
} else if (argument == QByteArray("-no-strip")) {
376-
LogDebug() << "Argument found:" << argument;
377-
runStripEnabled = false;
378-
} else if (argument == QByteArray("-bundle-non-qt-libs")) {
379-
LogDebug() << "Argument found:" << argument;
380-
bundleAllButCoreLibs = true;
381-
} else if (argument.startsWith(QByteArray("-verbose"))) {
382-
LogDebug() << "Argument found:" << argument;
383-
int index = argument.indexOf("=");
384-
bool ok = false;
385-
int number = argument.mid(index+1).toInt(&ok);
386-
if (!ok)
387-
LogError() << "Could not parse verbose level";
388-
else
389-
logLevel = number;
390-
} else if (argument.startsWith(QByteArray("-executable"))) {
391-
LogDebug() << "Argument found:" << argument;
392-
int index = argument.indexOf('=');
393-
if (index == -1)
394-
LogError() << "Missing executable path";
395-
else
396-
additionalExecutables << argument.mid(index+1);
397-
} else if (argument.startsWith(QByteArray("-qmldir"))) {
398-
LogDebug() << "Argument found:" << argument;
399-
qmldirArgumentUsed = true;
400-
int index = argument.indexOf('=');
401-
if (index == -1)
402-
LogError() << "Missing qml directory path";
403-
else
404-
qmlDirs << argument.mid(index+1);
405-
} else if (argument.startsWith("-no-copy-copyright-files")) {
406-
LogDebug() << "Argument found:" << argument;
407-
copyCopyrightFiles = false;
408-
} else if (argument == QByteArray("-always-overwrite")) {
409-
LogDebug() << "Argument found:" << argument;
410-
alwaysOwerwriteEnabled = true;
411-
} else if (argument.startsWith("-qmake=")) {
412-
LogDebug() << "Argument found:" << argument;
413-
int index = argument.indexOf("=");
414-
qmakeExecutable = argument.mid(index+1);
415-
} else if (argument == QByteArray("-no-translations")) {
416-
LogDebug() << "Argument found:" << argument;
417-
skipTranslations = true;
418-
} else if (argument.startsWith("-extra-plugins=")) {
419-
LogDebug() << "Argument found:" << argument;
420-
int index = argument.indexOf("=");
421-
extraQtPlugins = QString(argument.mid(index + 1)).split(",");
422-
} else if (argument.startsWith("-exclude-libs=")) {
423-
LogDebug() << "Argument found:" << argument;
424-
int index = argument.indexOf("=");
425-
excludeLibs = QString(argument.mid(index + 1)).split(",");
426-
} else if (argument.startsWith("--")) {
427-
LogError() << "Error: arguments must not start with --, only -:" << argument << "\n";
428-
return 1;
429-
} else {
430-
LogError() << "Unknown argument:" << argument << "\n";
431-
return 1;
432-
}
433-
}
434-
435440
if (appimage) {
436441
if(checkAppImagePrerequisites(appDirPath) == false){
437442
LogError() << "checkAppImagePrerequisites failed\n";

0 commit comments

Comments
 (0)