Merge branch 'qt--qpa-plugin-path'

This commit is contained in:
Thomas Tuegel 2017-05-14 13:55:42 -05:00
commit fabd48272f
No known key found for this signature in database
GPG Key ID: 22CBF5249D4B4D59
9 changed files with 133 additions and 17 deletions

View File

@ -104,6 +104,8 @@ stdenv.mkDerivation {
-importdir $out/lib/qt5/imports \
-qmldir $out/lib/qt5/qml \
-docdir $out/share/doc/qt5"
NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QPA_PLATFORM_PLUGIN_PATH=\"''${!outputLib}/lib/qt5/plugins/platforms\""
'';
prefixKey = "-prefix ";

View File

@ -0,0 +1,20 @@
Index: qtbase-opensource-src-5.6.2/src/corelib/kernel/qcoreapplication.cpp
===================================================================
--- qtbase-opensource-src-5.6.2.orig/src/corelib/kernel/qcoreapplication.cpp
+++ qtbase-opensource-src-5.6.2/src/corelib/kernel/qcoreapplication.cpp
@@ -2533,6 +2533,15 @@ QStringList QCoreApplication::libraryPat
QStringList *app_libpaths = new QStringList;
coreappdata()->app_libpaths.reset(app_libpaths);
+ // Add library paths derived from NIX_PROFILES.
+ const QByteArrayList profiles = qgetenv("NIX_PROFILES").split(' ');
+ const QString plugindir = QString::fromLatin1("/lib/qt5/plugins");
+ for (const QByteArray &profile: profiles) {
+ if (!profile.isEmpty()) {
+ app_libpaths->append(QFile::decodeName(profile) + plugindir);
+ }
+ }
+
const QByteArray libPathEnv = qgetenv("QT_PLUGIN_PATH");
if (!libPathEnv.isEmpty()) {
QStringList paths = QFile::decodeName(libPathEnv).split(QDir::listSeparator(), QString::SkipEmptyParts);

View File

@ -0,0 +1,43 @@
Index: qtbase-opensource-src-5.6.2/src/gui/kernel/qplatformintegrationfactory.cpp
===================================================================
--- qtbase-opensource-src-5.6.2.orig/src/gui/kernel/qplatformintegrationfactory.cpp
+++ qtbase-opensource-src-5.6.2/src/gui/kernel/qplatformintegrationfactory.cpp
@@ -67,9 +67,10 @@ QPlatformIntegration *QPlatformIntegrati
// Try loading the plugin from platformPluginPath first:
if (!platformPluginPath.isEmpty()) {
QCoreApplication::addLibraryPath(platformPluginPath);
- if (QPlatformIntegration *ret = loadIntegration(directLoader(), platform, paramList, argc, argv))
- return ret;
}
+ QCoreApplication::addLibraryPath(QStringLiteral(NIXPKGS_QPA_PLATFORM_PLUGIN_PATH));
+ if (QPlatformIntegration *ret = loadIntegration(directLoader(), platform, paramList, argc, argv))
+ return ret;
if (QPlatformIntegration *ret = loadIntegration(loader(), platform, paramList, argc, argv))
return ret;
#else
@@ -95,15 +96,16 @@ QStringList QPlatformIntegrationFactory:
QStringList list;
if (!platformPluginPath.isEmpty()) {
QCoreApplication::addLibraryPath(platformPluginPath);
- list = directLoader()->keyMap().values();
- if (!list.isEmpty()) {
- const QString postFix = QStringLiteral(" (from ")
- + QDir::toNativeSeparators(platformPluginPath)
- + QLatin1Char(')');
- const QStringList::iterator end = list.end();
- for (QStringList::iterator it = list.begin(); it != end; ++it)
- (*it).append(postFix);
- }
+ }
+ QCoreApplication::addLibraryPath(QStringLiteral(NIXPKGS_QPA_PLATFORM_PLUGIN_PATH));
+ list = directLoader()->keyMap().values();
+ if (!list.isEmpty()) {
+ const QString postFix = QStringLiteral(" (from ")
+ + QDir::toNativeSeparators(platformPluginPath)
+ + QLatin1Char(')');
+ const QStringList::iterator end = list.end();
+ for (QStringList::iterator it = list.begin(); it != end; ++it)
+ (*it).append(postFix);
}
list.append(loader()->keyMap().values());
return list;

View File

@ -4,5 +4,7 @@ dlopen-libXcursor.patch
dlopen-openssl.patch
dlopen-dbus.patch
xdg-config-dirs.patch
nix-profiles-library-paths.patch
compose-search-path.patch
libressl.patch
qpa-platform-plugin-path.patch

View File

@ -128,7 +128,7 @@ stdenv.mkDerivation {
-qmldir $out/lib/qt5/qml \
-docdir $out/share/doc/qt5"
NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QPA_PLATFORM_PLUGIN_PATH=\"''${!outputLib}/lib/qt5/plugins\""
NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QPA_PLATFORM_PLUGIN_PATH=\"''${!outputLib}/lib/qt5/plugins/platforms\""
'';

View File

@ -0,0 +1,20 @@
Index: qtbase-opensource-src-5.8.0/src/corelib/kernel/qcoreapplication.cpp
===================================================================
--- qtbase-opensource-src-5.8.0.orig/src/corelib/kernel/qcoreapplication.cpp
+++ qtbase-opensource-src-5.8.0/src/corelib/kernel/qcoreapplication.cpp
@@ -2476,6 +2476,15 @@ QStringList QCoreApplication::libraryPat
QStringList *app_libpaths = new QStringList;
coreappdata()->app_libpaths.reset(app_libpaths);
+ // Add library paths derived from NIX_PROFILES.
+ const QByteArrayList profiles = qgetenv("NIX_PROFILES").split(' ');
+ const QString plugindir = QString::fromLatin1("/lib/qt5/plugins");
+ for (const QByteArray &profile: profiles) {
+ if (!profile.isEmpty()) {
+ app_libpaths->append(QFile::decodeName(profile) + plugindir);
+ }
+ }
+
const QByteArray libPathEnv = qgetenv("QT_PLUGIN_PATH");
if (!libPathEnv.isEmpty()) {
QStringList paths = QFile::decodeName(libPathEnv).split(QDir::listSeparator(), QString::SkipEmptyParts);

View File

@ -0,0 +1,43 @@
Index: qtbase-opensource-src-5.8.0/src/gui/kernel/qplatformintegrationfactory.cpp
===================================================================
--- qtbase-opensource-src-5.8.0.orig/src/gui/kernel/qplatformintegrationfactory.cpp
+++ qtbase-opensource-src-5.8.0/src/gui/kernel/qplatformintegrationfactory.cpp
@@ -62,9 +62,10 @@ QPlatformIntegration *QPlatformIntegrati
// Try loading the plugin from platformPluginPath first:
if (!platformPluginPath.isEmpty()) {
QCoreApplication::addLibraryPath(platformPluginPath);
- if (QPlatformIntegration *ret = qLoadPlugin<QPlatformIntegration, QPlatformIntegrationPlugin>(directLoader(), platform, paramList, argc, argv))
- return ret;
}
+ QCoreApplication::addLibraryPath(QStringLiteral(NIXPKGS_QPA_PLATFORM_PLUGIN_PATH));
+ if (QPlatformIntegration *ret = qLoadPlugin<QPlatformIntegration, QPlatformIntegrationPlugin>(directLoader(), platform, paramList, argc, argv))
+ return ret;
#else
Q_UNUSED(platformPluginPath);
#endif
@@ -84,15 +85,16 @@ QStringList QPlatformIntegrationFactory:
#ifndef QT_NO_LIBRARY
if (!platformPluginPath.isEmpty()) {
QCoreApplication::addLibraryPath(platformPluginPath);
- list = directLoader()->keyMap().values();
- if (!list.isEmpty()) {
- const QString postFix = QLatin1String(" (from ")
- + QDir::toNativeSeparators(platformPluginPath)
- + QLatin1Char(')');
- const QStringList::iterator end = list.end();
- for (QStringList::iterator it = list.begin(); it != end; ++it)
- (*it).append(postFix);
- }
+ }
+ QCoreApplication::addLibraryPath(QStringLiteral(NIXPKGS_QPA_PLATFORM_PLUGIN_PATH));
+ list = directLoader()->keyMap().values();
+ if (!list.isEmpty()) {
+ const QString postFix = QLatin1String(" (from ")
+ + QDir::toNativeSeparators(platformPluginPath)
+ + QLatin1Char(')');
+ const QStringList::iterator end = list.end();
+ for (QStringList::iterator it = list.begin(); it != end; ++it)
+ (*it).append(postFix);
}
#else
Q_UNUSED(platformPluginPath);

View File

@ -1,15 +0,0 @@
Index: qtbase-opensource-src-5.8.0/src/gui/kernel/qguiapplication.cpp
===================================================================
--- qtbase-opensource-src-5.8.0.orig/src/gui/kernel/qguiapplication.cpp
+++ qtbase-opensource-src-5.8.0/src/gui/kernel/qguiapplication.cpp
@@ -1217,6 +1217,10 @@ void QGuiApplicationPrivate::createPlatf
// Load the platform integration
QString platformPluginPath = QString::fromLocal8Bit(qgetenv("QT_QPA_PLATFORM_PLUGIN_PATH"));
+ if (!platformPluginPath.isEmpty()) {
+ platformPluginPath.append(QStringLiteral(":"));
+ }
+ platformPluginPath.append(QStringLiteral(NIXPKGS_QPA_PLATFORM_PLUGIN_PATH));
QByteArray platformName;

View File

@ -2,8 +2,9 @@ dlopen-resolv.patch
tzdir.patch
dlopen-libXcursor.patch
xdg-config-dirs.patch
nix-profiles-library-paths.patch
libressl.patch
qpa-plugin-path.patch
qpa-platform-plugin-path.patch
dlopen-gl.patch
compose-search-path.patch
cmake-paths.patch