Skip to content

Commit

Permalink
Allow recursive folder addition of executables (closes #379) (#596)
Browse files Browse the repository at this point in the history
* Allow recursive folder addition of executables (closes #379)

* Remove mention of Bintray

---------

Co-authored-by: probonopd <probonopd@users.noreply.github.com>
  • Loading branch information
DrDub and probonopd committed Dec 27, 2023
1 parent ff74b85 commit 2b38449
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
4 changes: 2 additions & 2 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ If you just would like to bundle your application for x86_64 platforms, it is no

So, if you are on another platform (e.g. i686, ARM) or would like to compile from source, here are the steps:

* Get and build linuxdeployqt e.g., using Qt 5.7.0 (you could use this [Qt Creator AppImage](https://bintray.com/probono/AppImages/QtCreator#files) for this)
* Get and build linuxdeployqt

```
sudo apt-get -y install git g++ libgl1-mesa-dev
Expand All @@ -22,7 +22,7 @@ make
sudo make install
```

* Build and install [patchelf](https://nixos.org/patchelf.html) (a small utility to modify the dynamic linker and RPATH of ELF executables; similar to `install_name_tool` on macOS). To learn more about this, see http://blog.qt.io/blog/2011/10/28/rpath-and-runpath/
* Build and install [patchelf](https://nixos.org/patchelf.html) (a small utility to modify the dynamic linker and RPATH of ELF executables; similar to `install_name_tool` on macOS). To learn more about this, see http://blog.qt.io/blog/2011/10/28/rpath-and-runpath/. Also available as Debian package `patchelf`.

```
wget https://nixos.org/releases/patchelf/patchelf-0.9/patchelf-0.9.tar.bz2
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ Options:
searching for libraries.
-executable=<path> : Let the given executable use the deployed libraries
too
-executable-dir=<path> : Let all the executables in the folder (recursive) use
the deployed libraries too
-extra-plugins=<list> : List of extra plugins which should be deployed,
separated by comma.
-no-copy-copyright-files : Skip deployment of copyright files.
Expand Down
23 changes: 23 additions & 0 deletions tools/linuxdeployqt/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ int main(int argc, char **argv)
extern QStringList librarySearchPath;
extern bool alwaysOwerwriteEnabled;
QStringList additionalExecutables;
QStringList additionalExecutablesDir;
bool qmldirArgumentUsed = false;
bool skipTranslations = false;
bool skipGlibcCheck = false;
Expand Down Expand Up @@ -120,6 +121,13 @@ int main(int argc, char **argv)
LogError() << "Could not parse verbose level";
else
logLevel = number;
} else if (argument.startsWith(QByteArray("-executable-dir"))) {
LogDebug() << "Argument found:" << argument;
int index = argument.indexOf('=');
if (index == -1)
LogError() << "Missing executable folder path";
else
additionalExecutablesDir << argument.mid(index+1);
} else if (argument.startsWith(QByteArray("-executable"))) {
LogDebug() << "Argument found:" << argument;
int index = argument.indexOf('=');
Expand Down Expand Up @@ -228,6 +236,8 @@ int main(int argc, char **argv)
qInfo() << " searching for libraries.";
qInfo() << " -executable=<path> : Let the given executable use the deployed libraries";
qInfo() << " too";
qInfo() << " -executable-dir=<path> : Let all the executables in the folder (recursive) use";
qInfo() << " the deployed libraries too";
qInfo() << " -extra-plugins=<list> : List of extra plugins which should be deployed,";
qInfo() << " separated by comma.";
qInfo() << " -no-copy-copyright-files : Skip deployment of copyright files.";
Expand Down Expand Up @@ -496,6 +506,19 @@ int main(int argc, char **argv)
qWarning() << "WARNING: Excluding the following libraries might break the AppImage. Please double-check the list:" << excludeLibs;
}

// recurse folders for additional executables
for(const auto& folder : additionalExecutablesDir) {
QString directoryToBeSearched = QDir::cleanPath(QFileInfo(folder).absolutePath());
QDirIterator it(directoryToBeSearched, QDirIterator::Subdirectories);
while (it.hasNext()) {
it.next();
if((it.fileInfo().isFile()) && (it.fileInfo().isExecutable())){
qDebug() << "Found additional executable:" << it.fileInfo().canonicalFilePath();
additionalExecutables << it.fileInfo().absoluteFilePath();
}
}
}

DeploymentInfo deploymentInfo = deployQtLibraries(appDirPath, additionalExecutables,
qmakeExecutable);

Expand Down

0 comments on commit 2b38449

Please sign in to comment.