Skip to content

Commit f4d8888

Browse files
committed
Add option to avoid redundant copy of libraries (probonopd#327)
1 parent 6c26010 commit f4d8888

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ Options:
3636
-extra-plugins=<list> : List of extra plugins which should be deployed,
3737
separated by comma.
3838
-no-copy-copyright-files : Skip deployment of copyright files.
39+
-no-copy-packaged-libs : Don't copy libraries that are already contained in
40+
the package (e.g. in a subdirectory)
3941
-no-plugins : Skip plugin deployment.
4042
-no-strip : Don't run 'strip' on the binaries.
4143
-no-translations : Skip deployment of translations.

tools/linuxdeployqt/main.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ int main(int argc, char **argv)
8484
qInfo() << " -extra-plugins=<list> : List of extra plugins which should be deployed,";
8585
qInfo() << " separated by comma.";
8686
qInfo() << " -no-copy-copyright-files : Skip deployment of copyright files.";
87+
qInfo() << " -no-copy-packaged-libs : Don't copy libraries that are already contained in";
88+
qInfo() << " the package (e.g. in a subdirectory)";
8789
qInfo() << " -no-plugins : Skip plugin deployment.";
8890
qInfo() << " -no-strip : Don't run 'strip' on the binaries.";
8991
qInfo() << " -no-translations : Skip deployment of translations.";
@@ -222,6 +224,7 @@ int main(int argc, char **argv)
222224
extern QStringList excludeLibs;
223225
extern QStringList ignoreGlob;
224226
extern bool copyCopyrightFiles;
227+
extern bool copyPackagedLibs;
225228

226229
/* FHS-like mode is for an application that has been installed to a $PREFIX which is otherwise empty, e.g., /path/to/usr.
227230
* In this case, we want to construct an AppDir in /path/to. */
@@ -425,6 +428,9 @@ int main(int argc, char **argv)
425428
} else if (argument.startsWith("-no-copy-copyright-files")) {
426429
LogDebug() << "Argument found:" << argument;
427430
copyCopyrightFiles = false;
431+
} else if (argument.startsWith("-no-copy-packaged-libs")) {
432+
LogDebug() << "Argument found:" << argument;
433+
copyPackagedLibs = false;
428434
} else if (argument == QByteArray("-always-overwrite")) {
429435
LogDebug() << "Argument found:" << argument;
430436
alwaysOwerwriteEnabled = true;

tools/linuxdeployqt/shared.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ QStringList extraQtPlugins;
6262
QStringList excludeLibs;
6363
QStringList ignoreGlob;
6464
bool copyCopyrightFiles = true;
65+
bool copyPackagedLibs = true;
6566

6667
using std::cout;
6768
using std::endl;
@@ -520,7 +521,11 @@ LibraryInfo parseLddLibraryLine(const QString &line, const QString &appDirPath,
520521
info.deployedInstallName = "$ORIGIN"; // + info.binaryName;
521522
info.libraryPath = info.libraryDirectory + info.binaryName;
522523
info.sourceFilePath = info.libraryPath;
523-
info.libraryDestinationDirectory = bundleLibraryDirectory + "/";
524+
if (!copyPackagedLibs && info.libraryPath.contains(appDirPath))
525+
// leave libs that are already in the appdir in their current location
526+
info.libraryDestinationDirectory = QDir(appDirPath).relativeFilePath(info.libraryDirectory);
527+
else
528+
info.libraryDestinationDirectory = bundleLibraryDirectory + "/";
524529
info.binaryDestinationDirectory = info.libraryDestinationDirectory;
525530
info.binaryDirectory = info.libraryDirectory;
526531
info.binaryPath = info.libraryPath;

0 commit comments

Comments
 (0)