From 293431b4b1d18619f746a75446741174a3d48f6f Mon Sep 17 00:00:00 2001 From: Tom Dewey Date: Fri, 26 Jul 2024 09:59:44 +0100 Subject: [PATCH 1/2] deployers: Add WaylandShellIntegrationPluginsDeployer In order to effectively use the Wayland platform, you must provide shell integration plugins. Introduce a deployer for these, and a new environment variable, EXTRA_WAYLAND_SHELL_INTEGRATION_PLUGINS to specify them. --- src/deployers/CMakeLists.txt | 1 + src/deployers/PluginsDeployerFactory.cpp | 5 +++ ...WaylandShellIntegrationPluginsDeployer.cpp | 38 +++++++++++++++++++ .../WaylandShellIntegrationPluginsDeployer.h | 17 +++++++++ src/qt-modules.h | 1 + 5 files changed, 62 insertions(+) create mode 100644 src/deployers/WaylandShellIntegrationPluginsDeployer.cpp create mode 100644 src/deployers/WaylandShellIntegrationPluginsDeployer.h diff --git a/src/deployers/CMakeLists.txt b/src/deployers/CMakeLists.txt index 0833e05..d2a7e8f 100644 --- a/src/deployers/CMakeLists.txt +++ b/src/deployers/CMakeLists.txt @@ -22,6 +22,7 @@ set(CLASSES TextToSpeechPluginsDeployer TlsBackendsDeployer WaylandcompositorPluginsDeployer + WaylandShellIntegrationPluginsDeployer ) # TODO: CMake <= 3.7 (at least!) doesn't allow for using OBJECT libraries with target_link_libraries diff --git a/src/deployers/PluginsDeployerFactory.cpp b/src/deployers/PluginsDeployerFactory.cpp index ea88ec2..4aa44f9 100644 --- a/src/deployers/PluginsDeployerFactory.cpp +++ b/src/deployers/PluginsDeployerFactory.cpp @@ -18,6 +18,7 @@ #include "XcbglIntegrationPluginsDeployer.h" #include "TlsBackendsDeployer.h" #include "WaylandcompositorPluginsDeployer.h" +#include "WaylandShellIntegrationPluginsDeployer.h" using namespace linuxdeploy::plugin::qt; using namespace linuxdeploy::core::appdir; @@ -108,6 +109,10 @@ std::vector> PluginsDeployerFactory::getDeploye return {getInstance(moduleName)}; } + if (moduleName == "wayland-shell-integration") { + return {getInstance(moduleName)}; + } + // fallback return {getInstance(moduleName)}; } diff --git a/src/deployers/WaylandShellIntegrationPluginsDeployer.cpp b/src/deployers/WaylandShellIntegrationPluginsDeployer.cpp new file mode 100644 index 0000000..a8b6e82 --- /dev/null +++ b/src/deployers/WaylandShellIntegrationPluginsDeployer.cpp @@ -0,0 +1,38 @@ +// system headers +#include + +// library headers +#include +#include + +// local headers +#include "WaylandShellIntegrationPluginsDeployer.h" + +using namespace linuxdeploy::plugin::qt; +using namespace linuxdeploy::core::log; + +namespace fs = std::filesystem; + +bool WaylandShellIntegrationPluginsDeployer::deploy() { + // calling the default code is optional, but it won't hurt for now + if (!BasicPluginsDeployer::deploy()) + return false; + + ldLog() << "Deploying Wayland Shell Integration plugins" << std::endl; + + // always deploy default platform + if (!appDir.deployLibrary(qtPluginsPath / "wayland-shell-integration/libxdg-shell.so", appDir.path() / "usr/plugins/wayland-shell-integration/")) + return false; + + // deploy Wayland Shell Integration platform plugins, if any + const auto* const platformPluginsFromEnvData = getenv("EXTRA_WAYLAND_SHELL_INTEGRATION_PLUGINS"); + if (platformPluginsFromEnvData != nullptr) { + for (const auto& platformToDeploy : linuxdeploy::util::split(std::string(platformPluginsFromEnvData), ';')) { + ldLog() << "Deploying extra Wayland Shell Integration plugin: " << platformToDeploy << std::endl; + if (!appDir.deployLibrary(qtPluginsPath / "wayland-shell-integration" / platformToDeploy, appDir.path() / "usr/plugins/wayland-shell-integration/")) + return false; + } + } + + return true; +} diff --git a/src/deployers/WaylandShellIntegrationPluginsDeployer.h b/src/deployers/WaylandShellIntegrationPluginsDeployer.h new file mode 100644 index 0000000..91e67c5 --- /dev/null +++ b/src/deployers/WaylandShellIntegrationPluginsDeployer.h @@ -0,0 +1,17 @@ +#pragma once + +#include "BasicPluginsDeployer.h" + +namespace linuxdeploy { + namespace plugin { + namespace qt { + class WaylandShellIntegrationPluginsDeployer : public BasicPluginsDeployer { + public: + // we can just use the base class's constructor + using BasicPluginsDeployer::BasicPluginsDeployer; + + bool deploy() override; + }; + } + } +} \ No newline at end of file diff --git a/src/qt-modules.h b/src/qt-modules.h index 36246f7..4e6e9db 100644 --- a/src/qt-modules.h +++ b/src/qt-modules.h @@ -121,6 +121,7 @@ static const std::vector Qt6Modules = { {"test", "libQt6Test", "qtbase"}, {"uitools", "libQt6UiTools", ""}, {"waylandclient", "libQt6WaylandClient", ""}, + {"wayland-shell-integration", "libQt6WlShellIntegration", ""}, {"waylandcompositor", "libQt6WaylandCompositor", ""}, {"webenginecore", "libQt6WebEngineCore", ""}, {"webengine", "libQt6WebEngine", "qtwebengine"}, From 2e3d293925827468fa4dce79f25d35f8b9450eaa Mon Sep 17 00:00:00 2001 From: Tom Dewey Date: Fri, 26 Jul 2024 13:00:18 +0100 Subject: [PATCH 2/2] deployers: Introduce WaylandGraphicsIntegrationClient In order to use the Wayland QT QPA platform, you must provide: 1) libwayland 2) A shell integration plugin 3) A graphics integration plugin For Raspberry Pi Bookworm users, (1) is straightforward, (2) can rely on the default plugin, and (3) will likely be egl - but this deployer will just package all of them, if you ask for it. --- src/deployers/CMakeLists.txt | 1 + src/deployers/PluginsDeployerFactory.cpp | 5 +++ ...aphicsIntegrationClientPluginsDeployer.cpp | 34 +++++++++++++++++++ ...GraphicsIntegrationClientPluginsDeployer.h | 17 ++++++++++ src/qt-modules.h | 1 + 5 files changed, 58 insertions(+) create mode 100644 src/deployers/WaylandGraphicsIntegrationClientPluginsDeployer.cpp create mode 100644 src/deployers/WaylandGraphicsIntegrationClientPluginsDeployer.h diff --git a/src/deployers/CMakeLists.txt b/src/deployers/CMakeLists.txt index d2a7e8f..bf043e3 100644 --- a/src/deployers/CMakeLists.txt +++ b/src/deployers/CMakeLists.txt @@ -23,6 +23,7 @@ set(CLASSES TlsBackendsDeployer WaylandcompositorPluginsDeployer WaylandShellIntegrationPluginsDeployer + WaylandGraphicsIntegrationClientPluginsDeployer ) # TODO: CMake <= 3.7 (at least!) doesn't allow for using OBJECT libraries with target_link_libraries diff --git a/src/deployers/PluginsDeployerFactory.cpp b/src/deployers/PluginsDeployerFactory.cpp index 4aa44f9..59d71ca 100644 --- a/src/deployers/PluginsDeployerFactory.cpp +++ b/src/deployers/PluginsDeployerFactory.cpp @@ -19,6 +19,7 @@ #include "TlsBackendsDeployer.h" #include "WaylandcompositorPluginsDeployer.h" #include "WaylandShellIntegrationPluginsDeployer.h" +#include "WaylandGraphicsIntegrationClientPluginsDeployer.h" using namespace linuxdeploy::plugin::qt; using namespace linuxdeploy::core::appdir; @@ -113,6 +114,10 @@ std::vector> PluginsDeployerFactory::getDeploye return {getInstance(moduleName)}; } + if (moduleName == "wayland-graphics-integration-client") { + return {getInstance(moduleName)}; + } + // fallback return {getInstance(moduleName)}; } diff --git a/src/deployers/WaylandGraphicsIntegrationClientPluginsDeployer.cpp b/src/deployers/WaylandGraphicsIntegrationClientPluginsDeployer.cpp new file mode 100644 index 0000000..3d5ab81 --- /dev/null +++ b/src/deployers/WaylandGraphicsIntegrationClientPluginsDeployer.cpp @@ -0,0 +1,34 @@ +// system headers +#include + +// library headers +#include +#include + +// local headers +#include "WaylandGraphicsIntegrationClientPluginsDeployer.h" + +using namespace linuxdeploy::plugin::qt; +using namespace linuxdeploy::core::log; + +namespace fs = std::filesystem; + +bool WaylandGraphicsIntegrationClientPluginsDeployer::deploy() { + // calling the default code is optional, but it won't hurt for now + if (!BasicPluginsDeployer::deploy()) + return false; + + ldLog() << "Deploying Wayland Shell Integration plugins" << std::endl; + + for (fs::directory_iterator i(qtPluginsPath / "wayland-graphics-integration-client"); i != fs::directory_iterator(); ++i) { + if (i->path().extension() == ".debug") { + ldLog() << LD_DEBUG << "skipping .debug file:" << i->path() << std::endl; + continue; + } + + if (!appDir.deployLibrary(*i, appDir.path() / "usr/plugins/wayland-graphics-integration-client/")) + return false; + } + + return true; +} diff --git a/src/deployers/WaylandGraphicsIntegrationClientPluginsDeployer.h b/src/deployers/WaylandGraphicsIntegrationClientPluginsDeployer.h new file mode 100644 index 0000000..17cd10a --- /dev/null +++ b/src/deployers/WaylandGraphicsIntegrationClientPluginsDeployer.h @@ -0,0 +1,17 @@ +#pragma once + +#include "BasicPluginsDeployer.h" + +namespace linuxdeploy { + namespace plugin { + namespace qt { + class WaylandGraphicsIntegrationClientPluginsDeployer : public BasicPluginsDeployer { + public: + // we can just use the base class's constructor + using BasicPluginsDeployer::BasicPluginsDeployer; + + bool deploy() override; + }; + } + } +} \ No newline at end of file diff --git a/src/qt-modules.h b/src/qt-modules.h index 4e6e9db..0c85c01 100644 --- a/src/qt-modules.h +++ b/src/qt-modules.h @@ -122,6 +122,7 @@ static const std::vector Qt6Modules = { {"uitools", "libQt6UiTools", ""}, {"waylandclient", "libQt6WaylandClient", ""}, {"wayland-shell-integration", "libQt6WlShellIntegration", ""}, + {"wayland-graphics-integration-client", "", ""}, {"waylandcompositor", "libQt6WaylandCompositor", ""}, {"webenginecore", "libQt6WebEngineCore", ""}, {"webengine", "libQt6WebEngine", "qtwebengine"},