Added support for -excludeLibs command line option
This helps us avoid pesky libraries which are optional by the main binary but may be dragged in by some other libraries like https://github.com/probonopd/linuxdeployqt/issues/235 Usage: -exclude-libs=libqsqlibase,libqsqlodbc,libqsqlpsql,libqsqltds
This commit is contained in:
@@ -82,6 +82,8 @@ int main(int argc, char **argv)
|
|||||||
qInfo() << " -no-copy-copyright-files : Skip deployment of copyright files.";
|
qInfo() << " -no-copy-copyright-files : Skip deployment of copyright files.";
|
||||||
qInfo() << " -extra-plugins=<list> : List of extra plugins which should be deployed,";
|
qInfo() << " -extra-plugins=<list> : List of extra plugins which should be deployed,";
|
||||||
qInfo() << " separated by comma.";
|
qInfo() << " separated by comma.";
|
||||||
|
qInfo() << " -exclude-libs=<list> : List of extra plugins which should be deployed,";
|
||||||
|
qInfo() << " separated by comma.";
|
||||||
qInfo() << " -version : Print version statement and exit.";
|
qInfo() << " -version : Print version statement and exit.";
|
||||||
qInfo() << "";
|
qInfo() << "";
|
||||||
qInfo() << "linuxdeployqt takes an application as input and makes it";
|
qInfo() << "linuxdeployqt takes an application as input and makes it";
|
||||||
@@ -207,6 +209,7 @@ int main(int argc, char **argv)
|
|||||||
QStringList qmlDirs;
|
QStringList qmlDirs;
|
||||||
QString qmakeExecutable;
|
QString qmakeExecutable;
|
||||||
extern QStringList extraQtPlugins;
|
extern QStringList extraQtPlugins;
|
||||||
|
extern QStringList excludeLibs;
|
||||||
extern bool copyCopyrightFiles;
|
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.
|
/* FHS-like mode is for an application that has been installed to a $PREFIX which is otherwise empty, e.g., /path/to/usr.
|
||||||
@@ -416,6 +419,10 @@ int main(int argc, char **argv)
|
|||||||
LogDebug() << "Argument found:" << argument;
|
LogDebug() << "Argument found:" << argument;
|
||||||
int index = argument.indexOf("=");
|
int index = argument.indexOf("=");
|
||||||
extraQtPlugins = QString(argument.mid(index + 1)).split(",");
|
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("-")) {
|
} else if (argument.startsWith("-")) {
|
||||||
LogError() << "Error: arguments must not start with --, only -" << "\n";
|
LogError() << "Error: arguments must not start with --, only -" << "\n";
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ int qtDetected = 0;
|
|||||||
bool qtDetectionComplete = 0; // As long as Qt is not detected yet, ldd may encounter "not found" messages, continue anyway
|
bool qtDetectionComplete = 0; // As long as Qt is not detected yet, ldd may encounter "not found" messages, continue anyway
|
||||||
bool deployLibrary = false;
|
bool deployLibrary = false;
|
||||||
QStringList extraQtPlugins;
|
QStringList extraQtPlugins;
|
||||||
|
QStringList excludeLibs;
|
||||||
bool copyCopyrightFiles = true;
|
bool copyCopyrightFiles = true;
|
||||||
|
|
||||||
using std::cout;
|
using std::cout;
|
||||||
@@ -473,6 +474,7 @@ LibraryInfo parseLddLibraryLine(const QString &line, const QString &appDirPath,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
QStringList excludelist;
|
QStringList excludelist;
|
||||||
|
excludelist += excludeLibs;
|
||||||
excludelist << "libasound.so.2" << "libcom_err.so.2" << "libcrypt.so.1" << "libc.so.6" << "libdl.so.2" << "libdrm.so.2" << "libexpat.so.1" << "libfontconfig.so.1" << "libgcc_s.so.1" << "libgdk_pixbuf-2.0.so.0" << "libgio-2.0.so.0" << "libglib-2.0.so.0" << "libGL.so.1" << "libgobject-2.0.so.0" << "libgpg-error.so.0" << "libICE.so.6" << "libkeyutils.so.1" << "libm.so.6" << "libnsl.so.1" << "libnss3.so" << "libnssutil3.so" << "libp11-kit.so.0" << "libpangoft2-1.0.so.0" << "libpangocairo-1.0.so.0" << "libpango-1.0.so.0" << "libpthread.so.0" << "libresolv.so.2" << "librt.so.1" << "libSM.so.6" << "libstdc++.so.6" << "libusb-1.0.so.0" << "libuuid.so.1" << "libX11.so.6" << "libxcb.so.1" << "libz.so.1";
|
excludelist << "libasound.so.2" << "libcom_err.so.2" << "libcrypt.so.1" << "libc.so.6" << "libdl.so.2" << "libdrm.so.2" << "libexpat.so.1" << "libfontconfig.so.1" << "libgcc_s.so.1" << "libgdk_pixbuf-2.0.so.0" << "libgio-2.0.so.0" << "libglib-2.0.so.0" << "libGL.so.1" << "libgobject-2.0.so.0" << "libgpg-error.so.0" << "libICE.so.6" << "libkeyutils.so.1" << "libm.so.6" << "libnsl.so.1" << "libnss3.so" << "libnssutil3.so" << "libp11-kit.so.0" << "libpangoft2-1.0.so.0" << "libpangocairo-1.0.so.0" << "libpango-1.0.so.0" << "libpthread.so.0" << "libresolv.so.2" << "librt.so.1" << "libSM.so.6" << "libstdc++.so.6" << "libusb-1.0.so.0" << "libuuid.so.1" << "libX11.so.6" << "libxcb.so.1" << "libz.so.1";
|
||||||
LogDebug() << "excludelist:" << excludelist;
|
LogDebug() << "excludelist:" << excludelist;
|
||||||
if (! trimmed.contains("libicu")) {
|
if (! trimmed.contains("libicu")) {
|
||||||
@@ -666,6 +668,8 @@ QList<LibraryInfo> getQtLibrariesForPaths(const QStringList &paths, const QStrin
|
|||||||
QSet<QString> existing;
|
QSet<QString> existing;
|
||||||
|
|
||||||
foreach (const QString &path, paths) {
|
foreach (const QString &path, paths) {
|
||||||
|
if (!excludeLibs.contains(QFileInfo(path).baseName()))
|
||||||
|
{
|
||||||
foreach (const LibraryInfo &info, getQtLibraries(path, appDirPath, rpaths)) {
|
foreach (const LibraryInfo &info, getQtLibraries(path, appDirPath, rpaths)) {
|
||||||
if (!existing.contains(info.libraryPath)) { // avoid duplicates
|
if (!existing.contains(info.libraryPath)) { // avoid duplicates
|
||||||
existing.insert(info.libraryPath);
|
existing.insert(info.libraryPath);
|
||||||
@@ -673,6 +677,7 @@ QList<LibraryInfo> getQtLibrariesForPaths(const QStringList &paths, const QStrin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1394,6 +1399,8 @@ void deployPlugins(const AppDirInfo &appDirInfo, const QString &pluginSourcePath
|
|||||||
foreach (const QString &plugin, pluginList) {
|
foreach (const QString &plugin, pluginList) {
|
||||||
sourcePath = pluginSourcePath + "/" + plugin;
|
sourcePath = pluginSourcePath + "/" + plugin;
|
||||||
destinationPath = pluginDestinationPath + "/" + plugin;
|
destinationPath = pluginDestinationPath + "/" + plugin;
|
||||||
|
if(!excludeLibs.contains(QFileInfo(sourcePath).baseName()))
|
||||||
|
{
|
||||||
QDir dir;
|
QDir dir;
|
||||||
dir.mkpath(QFileInfo(destinationPath).path());
|
dir.mkpath(QFileInfo(destinationPath).path());
|
||||||
QList<LibraryInfo> libraries = getQtLibraries(sourcePath, appDirInfo.path, deploymentInfo.rpathsUsed);
|
QList<LibraryInfo> libraries = getQtLibraries(sourcePath, appDirInfo.path, deploymentInfo.rpathsUsed);
|
||||||
@@ -1413,6 +1420,7 @@ void deployPlugins(const AppDirInfo &appDirInfo, const QString &pluginSourcePath
|
|||||||
copyCopyrightFile(sourcePath);
|
copyCopyrightFile(sourcePath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void createQtConf(const QString &appDirPath)
|
void createQtConf(const QString &appDirPath)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ extern bool bundleAllButCoreLibs;
|
|||||||
extern bool fhsLikeMode;
|
extern bool fhsLikeMode;
|
||||||
extern QString fhsPrefix;
|
extern QString fhsPrefix;
|
||||||
extern QStringList extraQtPlugins;
|
extern QStringList extraQtPlugins;
|
||||||
|
extern QStringList excludeLibs;
|
||||||
|
|
||||||
class LibraryInfo
|
class LibraryInfo
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user