-
-
Notifications
You must be signed in to change notification settings - Fork 15k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: Loads qt plugin paths as registered...
This adds the list of Qt plugin paths into builds using `qtbase`. The plugins list will be added to the Qt plugin path through the additional patch. This ensures that no special environment is required to get the desired plugin path for Qt software. This should fix all issues where Qt is unable to load its platform plugin. This may fix the issue where Qt tries to load a mismatched version of a plugin.
- Loading branch information
Showing
6 changed files
with
129 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
pkgs/development/libraries/qt-5/5.11/qtbase-additional.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp | ||
index 5ae3fd62e5..ec3fccfc76 100644 | ||
--- a/src/corelib/kernel/qcoreapplication.cpp | ||
+++ b/src/corelib/kernel/qcoreapplication.cpp | ||
@@ -2533,6 +2533,27 @@ QStringList QCoreApplication::libraryPaths() | ||
QStringList *app_libpaths = new QStringList; | ||
coreappdata()->app_libpaths.reset(app_libpaths); | ||
|
||
+ { | ||
+ // Start at the binary; this allows us to *always* start by stripping the last part. | ||
+ QStringList components = applicationFilePath().split(QDir::separator()); | ||
+ | ||
+ // We don't care about /nix/store/nix-support, only /nix/store/*/nix-support | ||
+ // This is why we're checking for more than 3 parts. It will bail out once /nix/xtore/*/nix-support/qt-plugin-paths has been tested. | ||
+ while (components.length() > 4) { | ||
+ components.removeLast(); | ||
+ const QString support_plugin_paths = QDir::cleanPath(QDir::separator() + components.join(QDir::separator()) + QStringLiteral("/nix-support/qt-plugin-paths")); | ||
+ if (QFile::exists(support_plugin_paths)) { | ||
+ QFile file(support_plugin_paths); | ||
+ if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { | ||
+ QTextStream in(&file); | ||
+ while (!in.atEnd()) { | ||
+ app_libpaths->append(in.readLine()); | ||
+ } | ||
+ } | ||
+ } | ||
+ } | ||
+ } | ||
+ | ||
// Add library paths derived from PATH | ||
const QStringList paths = QFile::decodeName(qgetenv("PATH")).split(':'); | ||
const QString plugindir = QStringLiteral("../" NIXPKGS_QT_PLUGIN_PREFIX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
pkgs/development/libraries/qt-5/5.9/qtbase-additional.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp | ||
index 5ae3fd62e5..ec3fccfc76 100644 | ||
--- a/src/corelib/kernel/qcoreapplication.cpp | ||
+++ b/src/corelib/kernel/qcoreapplication.cpp | ||
@@ -2533,6 +2533,27 @@ QStringList QCoreApplication::libraryPaths() | ||
QStringList *app_libpaths = new QStringList; | ||
coreappdata()->app_libpaths.reset(app_libpaths); | ||
|
||
+ { | ||
+ // Start at the binary; this allows us to *always* start by stripping the last part. | ||
+ QStringList components = applicationFilePath().split(QDir::separator()); | ||
+ | ||
+ // We don't care about /nix/store/nix-support, only /nix/store/*/nix-support | ||
+ // This is why we're checking for more than 3 parts. It will bail out once /nix/xtore/*/nix-support/qt-plugin-paths has been tested. | ||
+ while (components.length() > 4) { | ||
+ components.removeLast(); | ||
+ const QString support_plugin_paths = QDir::cleanPath(QDir::separator() + components.join(QDir::separator()) + QStringLiteral("/nix-support/qt-plugin-paths")); | ||
+ if (QFile::exists(support_plugin_paths)) { | ||
+ QFile file(support_plugin_paths); | ||
+ if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { | ||
+ QTextStream in(&file); | ||
+ while (!in.atEnd()) { | ||
+ app_libpaths->append(in.readLine()); | ||
+ } | ||
+ } | ||
+ } | ||
+ } | ||
+ } | ||
+ | ||
// Add library paths derived from PATH | ||
const QStringList paths = QFile::decodeName(qgetenv("PATH")).split(':'); | ||
const QString plugindir = QStringLiteral("../" NIXPKGS_QT_PLUGIN_PREFIX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters