Merge pull request #253 from saidinesh5/master
Added support for -excludeLibs command line option
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 libraries which should be excluded,";
|
||||||
|
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 -:" << argument << "\n";
|
LogError() << "Error: arguments must not start with --, only -:" << argument << "\n";
|
||||||
return 1;
|
return 1;
|
||||||
@@ -432,6 +439,11 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!excludeLibs.isEmpty())
|
||||||
|
{
|
||||||
|
qWarning() << "WARNING: Excluding the following libraries might break the AppImage. Please double-check the list:" << excludeLibs;
|
||||||
|
}
|
||||||
|
|
||||||
DeploymentInfo deploymentInfo = deployQtLibraries(appDirPath, additionalExecutables,
|
DeploymentInfo deploymentInfo = deployQtLibraries(appDirPath, additionalExecutables,
|
||||||
qmakeExecutable);
|
qmakeExecutable);
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -478,6 +479,7 @@ LibraryInfo parseLddLibraryLine(const QString &line, const QString &appDirPath,
|
|||||||
#else
|
#else
|
||||||
excludelist << EXCLUDELIST;
|
excludelist << EXCLUDELIST;
|
||||||
#endif
|
#endif
|
||||||
|
excludelist += excludeLibs;
|
||||||
|
|
||||||
LogDebug() << "excludelist:" << excludelist;
|
LogDebug() << "excludelist:" << excludelist;
|
||||||
if (! trimmed.contains("libicu")) {
|
if (! trimmed.contains("libicu")) {
|
||||||
@@ -671,10 +673,13 @@ QList<LibraryInfo> getQtLibrariesForPaths(const QStringList &paths, const QStrin
|
|||||||
QSet<QString> existing;
|
QSet<QString> existing;
|
||||||
|
|
||||||
foreach (const QString &path, paths) {
|
foreach (const QString &path, paths) {
|
||||||
foreach (const LibraryInfo &info, getQtLibraries(path, appDirPath, rpaths)) {
|
if (!excludeLibs.contains(QFileInfo(path).baseName()))
|
||||||
if (!existing.contains(info.libraryPath)) { // avoid duplicates
|
{
|
||||||
existing.insert(info.libraryPath);
|
foreach (const LibraryInfo &info, getQtLibraries(path, appDirPath, rpaths)) {
|
||||||
result << info;
|
if (!existing.contains(info.libraryPath)) { // avoid duplicates
|
||||||
|
existing.insert(info.libraryPath);
|
||||||
|
result << info;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1022,7 +1027,7 @@ DeploymentInfo deployQtLibraries(QList<LibraryInfo> libraries,
|
|||||||
deploymentInfo.qtPath = library.libraryDirectory;
|
deploymentInfo.qtPath = library.libraryDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(library.libraryName.contains("libQt") and library.libraryName.contains("Widgets.so")) {
|
if(library.libraryName.contains("libQt") and library.libraryName.contains("Widgets.so")) {
|
||||||
deploymentInfo.requiresQtWidgetsLibrary = true;
|
deploymentInfo.requiresQtWidgetsLibrary = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1399,23 +1404,26 @@ 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;
|
||||||
QDir dir;
|
if(!excludeLibs.contains(QFileInfo(sourcePath).baseName()))
|
||||||
dir.mkpath(QFileInfo(destinationPath).path());
|
{
|
||||||
QList<LibraryInfo> libraries = getQtLibraries(sourcePath, appDirInfo.path, deploymentInfo.rpathsUsed);
|
QDir dir;
|
||||||
LogDebug() << "Deploying plugin" << sourcePath;
|
dir.mkpath(QFileInfo(destinationPath).path());
|
||||||
if (copyFilePrintStatus(sourcePath, destinationPath)) {
|
QList<LibraryInfo> libraries = getQtLibraries(sourcePath, appDirInfo.path, deploymentInfo.rpathsUsed);
|
||||||
runStrip(destinationPath);
|
LogDebug() << "Deploying plugin" << sourcePath;
|
||||||
deployQtLibraries(libraries, appDirInfo.path, QStringList() << destinationPath, deploymentInfo.useLoaderPath);
|
if (copyFilePrintStatus(sourcePath, destinationPath)) {
|
||||||
/* See whether this makes any difference */
|
runStrip(destinationPath);
|
||||||
// Find out the relative path to the lib/ directory and set it as the rpath
|
deployQtLibraries(libraries, appDirInfo.path, QStringList() << destinationPath, deploymentInfo.useLoaderPath);
|
||||||
QDir dir(destinationPath);
|
/* See whether this makes any difference */
|
||||||
QString relativePath = dir.relativeFilePath(appDirInfo.path + "/" + libraries[0].libraryDestinationDirectory);
|
// Find out the relative path to the lib/ directory and set it as the rpath
|
||||||
relativePath.remove(0, 3); // remove initial '../'
|
QDir dir(destinationPath);
|
||||||
changeIdentification("$ORIGIN/" + relativePath, QFileInfo(destinationPath).canonicalFilePath());
|
QString relativePath = dir.relativeFilePath(appDirInfo.path + "/" + libraries[0].libraryDestinationDirectory);
|
||||||
|
relativePath.remove(0, 3); // remove initial '../'
|
||||||
|
changeIdentification("$ORIGIN/" + relativePath, QFileInfo(destinationPath).canonicalFilePath());
|
||||||
|
|
||||||
|
}
|
||||||
|
LogDebug() << "copyCopyrightFile:" << sourcePath;
|
||||||
|
copyCopyrightFile(sourcePath);
|
||||||
}
|
}
|
||||||
LogDebug() << "copyCopyrightFile:" << sourcePath;
|
|
||||||
copyCopyrightFile(sourcePath);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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