-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy pathPlatformPluginsDeployer.cpp
More file actions
99 lines (81 loc) · 5.26 KB
/
PlatformPluginsDeployer.cpp
File metadata and controls
99 lines (81 loc) · 5.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
// library headers
#include <linuxdeploy/core/log.h>
#include <boost/filesystem.hpp>
// local headers
#include "PlatformPluginsDeployer.h"
using namespace linuxdeploy::plugin::qt;
using namespace linuxdeploy::core::log;
namespace bf = boost::filesystem;
bool PlatformPluginsDeployer::deploy() {
// calling the default code is optional, but it won't hurt for now
if (!BasicPluginsDeployer::deploy())
return false;
ldLog() << "Deploying platform plugins" << std::endl;
if (getenv("ENABLE_EGLFS")){
if (!appDir.deployLibrary(qtPluginsPath / "platforms/libqxcb.so", appDir.path() / "usr/plugins/platforms/"))
ldLog() << "No XCB platform plugin found, skipping" << std::endl;
if (!appDir.deployLibrary(qtPluginsPath / "platforms/libqeglfs.so", appDir.path() / "usr/plugins/platforms/"))
ldLog() << "No EGLFS platform plugin found, skipping" << std::endl;
if (!appDir.deployLibrary(qtPluginsPath / "egldeviceintegrations/libqeglfs-kms-integration.so", appDir.path() / "usr/plugins/egldeviceintegrations/"))
ldLog() << "No EGLFS KMS Integration plugin found, skipping" << std::endl;
if (!appDir.deployLibrary(qtPluginsPath / "egldeviceintegrations/libqeglfs-x11-integration.so", appDir.path() / "usr/plugins/egldeviceintegrations/"))
ldLog() << "No EGLFS X11 Integration plugin found, skipping" << std::endl;
if (!appDir.deployLibrary(qtPluginsPath / "egldeviceintegrations/libqeglfs-kms-egldevice-integration.so", appDir.path() / "usr/plugins/egldeviceintegrations/"))
ldLog() << "No EGLFS KMS EGLDEVICE Integration plugin found, skipping" << std::endl;
if (!appDir.deployLibrary(qtPluginsPath / "egldeviceintegrations/libqeglfs-kms-emu-integration.so", appDir.path() / "usr/plugins/egldeviceintegrations/"))
ldLog() << "No EGLFS EMU Integration plugin found, skipping" << std::endl;
} else {
if (!appDir.deployLibrary(qtPluginsPath / "platforms/libqxcb.so", appDir.path() / "usr/plugins/platforms/"))
return false;
}
for (bf::directory_iterator i(qtPluginsPath / "platforminputcontexts"); i != bf::directory_iterator(); ++i) {
if (!appDir.deployLibrary(*i, appDir.path() / "usr/plugins/platforminputcontexts/"))
return false;
}
for (bf::directory_iterator i(qtPluginsPath / "imageformats"); i != bf::directory_iterator(); ++i) {
if (!appDir.deployLibrary(*i, appDir.path() / "usr/plugins/imageformats/"))
return false;
}
// TODO: platform themes -- https://github.com/probonopd/linuxdeployqt/issues/236
const bf::path platformThemesPath = qtPluginsPath / "platformthemes";
const bf::path stylesPath = qtPluginsPath / "styles";
const bf::path platformThemesDestination = appDir.path() / "usr/plugins/platformthemes/";
const bf::path stylesDestination = appDir.path() / "usr/plugins/styles/";
if (getenv("DEPLOY_PLATFORM_THEMES") != nullptr) {
ldLog() << LD_WARNING << "Deploying all platform themes and styles [experimental feature]" << std::endl;
if (bf::is_directory(platformThemesPath))
for (bf::directory_iterator i(platformThemesPath); i != bf::directory_iterator(); ++i)
if (!appDir.deployLibrary(*i, platformThemesDestination))
return false;
if (bf::is_directory(stylesPath))
for (bf::directory_iterator i(stylesPath); i != bf::directory_iterator(); ++i)
if (!appDir.deployLibrary(*i, stylesDestination))
return false;
} else {
ldLog() << "Trying to deploy Gtk 2 platform theme and/or style" << std::endl;
// according to probono, only the files shall be deployed, not their dependencies
// either loading succeeds, then the system Gtk shall be used anyway, otherwise loading fails and Qt will fall
// back to the default UI theme
// we don't care whether this works (it's an experimental feature), therefore we ignore the return values
const auto libqgtk2Path = platformThemesPath / "libqgtk2.so";
const auto libqgtk3Path = platformThemesPath / "libqgtk3.so";
const auto libqxdgPath = platformThemesPath / "libqxdgdesktopportal.so";
for (const auto &file : {libqgtk2Path, libqgtk3Path, libqxdgPath}) {
// we need to check whether the files exist at least, otherwise the deferred deployment operation fails
if (bf::is_regular_file(file)) {
ldLog() << "Attempting to deploy" << file.filename() << "found at path" << file.parent_path() << std::endl;
appDir.deployFile(file, platformThemesDestination);
} else {
ldLog() << "Could not find" << file.filename() << "on system, skipping deployment" << std::endl;
}
}
const auto libqgtk2stylePath = stylesPath / "libqgtk2style.so";
if (bf::is_regular_file(libqgtk2stylePath)) {
ldLog() << "Attempting to deploy" << libqgtk2stylePath.filename() << "found at path" << libqgtk2stylePath << std::endl;
appDir.deployFile(libqgtk2stylePath, stylesDestination);
} else {
ldLog() << "Could not find" << libqgtk2stylePath.filename() << "on system, skipping deployment" << std::endl;
}
}
return true;
}