From ae599bbd1bd6958d07ac4641133aee74bc1aed0e Mon Sep 17 00:00:00 2001 From: Anton Korobeynikov Date: Thu, 21 Jul 2022 16:26:09 +0300 Subject: [PATCH 1/3] Allow installation of extra platform plugins Resolves #88 --- README.md | 1 + ci/test.sh | 11 +++++++++++ src/deployers/PlatformPluginsDeployer.cpp | 11 +++++++++++ 3 files changed, 23 insertions(+) diff --git a/README.md b/README.md index 5b6965e..252e932 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,7 @@ Just like all linuxdeploy plugins, the Qt plugin's behavior can be configured so **Qt specific:** - `$QMAKE=/path/to/my/qmake`: use another `qmake` binary to detect paths of plugins and other resources (usually doesn't need to be set manually, most Qt environments ship scripts changing `$PATH`) - `$EXTRA_QT_PLUGINS=pluginA;pluginB`: Plugins to deploy even if not found automatically by linuxdeploy-plugin-qt +- `$EXTRA_PLATFORM_PLUGINS=platformA;platformB`: Platforms to deploy in addition to `libqxcb.so`. Platform must be available from `QT_INSTALL_PLUGINS/platforms`. QML related: - `$QML_SOURCES_PATHS`: directory containing the application's QML files — useful/needed if QML files are "baked" into the binaries. `$QT_INSTALL_QML` is prepended to this list internally. diff --git a/ci/test.sh b/ci/test.sh index 331e0c3..97702a0 100755 --- a/ci/test.sh +++ b/ci/test.sh @@ -87,4 +87,15 @@ pushd linuxdeploy-plugin-qt-examples/QtWidgetsApplication "$linuxdeploy_bin" --appdir "$PWD"/AppDir --plugin qt --output appimage || exit 1 mv -v *AppImage "$build_dir" || exit 1 popd + + mkdir build-platforms + pushd build-platforms + export EXTRA_PLATFORM_PLUGINS="libqoffscreen.so;libqminimal.so" + qmake CONFIG+=release PREFIX=/usr ../QtWidgetsApplication.pro || exit 1 + INSTALL_ROOT="$PWD"/AppDir make install || exit 1 + + "$LINUXDEPLOY_BIN" --appdir "$PWD"/AppDir --plugin qt --output appimage || exit 1 + APPIMAGE=(*AppImage) + mv -v "${APPIMAGE[0]}" "$BUILD_DIR/offscreen-${APPIMAGE[0]}" || exit 1 + popd popd diff --git a/src/deployers/PlatformPluginsDeployer.cpp b/src/deployers/PlatformPluginsDeployer.cpp index 7011abe..9ff2b34 100644 --- a/src/deployers/PlatformPluginsDeployer.cpp +++ b/src/deployers/PlatformPluginsDeployer.cpp @@ -1,5 +1,6 @@ // library headers #include +#include #include // local headers @@ -17,9 +18,19 @@ bool PlatformPluginsDeployer::deploy() { ldLog() << "Deploying platform plugins" << std::endl; + // always deploy default platform if (!appDir.deployLibrary(qtPluginsPath / "platforms/libqxcb.so", appDir.path() / "usr/plugins/platforms/")) return false; + // deploy extra platform plugins, if any + if (const auto* const platformPluginsFromEnvData = getenv("EXTRA_PLATFORM_PLUGINS")) { + for (const auto& platformToDeploy : linuxdeploy::util::split(std::string(platformPluginsFromEnvData), ';')) { + ldLog() << "Deploying extra platform plugin: " << platformToDeploy << std::endl; + if (!appDir.deployLibrary(qtPluginsPath / "platforms" / platformToDeploy, 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; From b06324b5881f1d03883f200c207aae2ff4bbb5aa Mon Sep 17 00:00:00 2001 From: Anton Korobeynikov Date: Fri, 26 Aug 2022 14:19:51 +0300 Subject: [PATCH 2/3] Address review comments --- src/deployers/PlatformPluginsDeployer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/deployers/PlatformPluginsDeployer.cpp b/src/deployers/PlatformPluginsDeployer.cpp index 9ff2b34..61c7a17 100644 --- a/src/deployers/PlatformPluginsDeployer.cpp +++ b/src/deployers/PlatformPluginsDeployer.cpp @@ -23,7 +23,8 @@ bool PlatformPluginsDeployer::deploy() { return false; // deploy extra platform plugins, if any - if (const auto* const platformPluginsFromEnvData = getenv("EXTRA_PLATFORM_PLUGINS")) { + const auto* const platformPluginsFromEnvData = getenv("EXTRA_PLATFORM_PLUGINS"); + if (platformPluginsFromEnvData != nullptr) { for (const auto& platformToDeploy : linuxdeploy::util::split(std::string(platformPluginsFromEnvData), ';')) { ldLog() << "Deploying extra platform plugin: " << platformToDeploy << std::endl; if (!appDir.deployLibrary(qtPluginsPath / "platforms" / platformToDeploy, appDir.path() / "usr/plugins/platforms/")) From c20ae97322d522b1bc3e5b19780b3657fe74ac84 Mon Sep 17 00:00:00 2001 From: Anton Korobeynikov Date: Fri, 26 Aug 2022 14:37:32 +0300 Subject: [PATCH 3/3] Update test --- ci/test.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ci/test.sh b/ci/test.sh index 97702a0..3d31828 100755 --- a/ci/test.sh +++ b/ci/test.sh @@ -94,8 +94,7 @@ pushd linuxdeploy-plugin-qt-examples/QtWidgetsApplication qmake CONFIG+=release PREFIX=/usr ../QtWidgetsApplication.pro || exit 1 INSTALL_ROOT="$PWD"/AppDir make install || exit 1 - "$LINUXDEPLOY_BIN" --appdir "$PWD"/AppDir --plugin qt --output appimage || exit 1 - APPIMAGE=(*AppImage) - mv -v "${APPIMAGE[0]}" "$BUILD_DIR/offscreen-${APPIMAGE[0]}" || exit 1 + env OUTPUT=platforms.AppImage "$linuxdeploy_bin" --appdir "$PWD"/AppDir --plugin qt --output appimage || exit 1 + mv -v platforms.AppImage "$build_dir" || exit 1 popd popd