|
1 | 1 | // library headers
|
2 | 2 | #include <linuxdeploy/core/log.h>
|
3 |
| -#include <boost/filesystem.hpp> |
4 | 3 |
|
5 | 4 | // local headers
|
6 | 5 | #include "PlatformPluginsDeployer.h"
|
| 6 | +#include "linuxdeploy/util/util.h" |
7 | 7 |
|
8 | 8 | using namespace linuxdeploy::plugin::qt;
|
9 | 9 | using namespace linuxdeploy::core::log;
|
10 | 10 |
|
11 | 11 | namespace bf = boost::filesystem;
|
12 | 12 |
|
| 13 | +PlatformPluginsDeployer::PlatformPluginsDeployer(std::string moduleName, |
| 14 | + core::appdir::AppDir& appDir, |
| 15 | + bf::path qtPluginsPath, |
| 16 | + bf::path qtLibexecsPath, |
| 17 | + bf::path installLibsPath, |
| 18 | + bf::path qtTranslationsPath, |
| 19 | + bf::path qtDataPath): |
| 20 | + BasicPluginsDeployer(std::move(moduleName), |
| 21 | + appDir, |
| 22 | + std::move(qtPluginsPath), |
| 23 | + std::move(qtLibexecsPath), |
| 24 | + std::move(installLibsPath), |
| 25 | + std::move(qtTranslationsPath), |
| 26 | + std::move(qtDataPath)) { |
| 27 | + // check if the platform plugins are set in env |
| 28 | + const auto* const platformPluginsFromEnvData = getenv("PLATFORM_PLUGINS"); |
| 29 | + if (platformPluginsFromEnvData != nullptr) |
| 30 | + platformToDeploy = linuxdeploy::util::split(std::string(platformPluginsFromEnvData), ';'); |
| 31 | + else { |
| 32 | + // default to libqxcb if nothing is provided |
| 33 | + platformToDeploy.emplace_back("libqxcb.so"); |
| 34 | + } |
| 35 | +} |
| 36 | + |
13 | 37 | bool PlatformPluginsDeployer::deploy() {
|
14 | 38 | // calling the default code is optional, but it won't hurt for now
|
15 | 39 | if (!BasicPluginsDeployer::deploy())
|
16 | 40 | return false;
|
17 | 41 |
|
18 | 42 | ldLog() << "Deploying platform plugins" << std::endl;
|
| 43 | + for (auto& platform : platformToDeploy) { |
| 44 | + if (!appDir.deployLibrary(qtPluginsPath / "platforms" / platform, appDir.path() / "usr/plugins/platforms/")) |
| 45 | + return false; |
| 46 | + } |
19 | 47 |
|
20 |
| - if (!appDir.deployLibrary(qtPluginsPath / "platforms/libqxcb.so", appDir.path() / "usr/plugins/platforms/")) |
21 |
| - return false; |
22 | 48 |
|
23 | 49 | for (bf::directory_iterator i(qtPluginsPath / "platforminputcontexts"); i != bf::directory_iterator(); ++i) {
|
24 | 50 | if (!appDir.deployLibrary(*i, appDir.path() / "usr/plugins/platforminputcontexts/"))
|
|
0 commit comments