qt56: determine plugin and import paths from PATH

Plugin and QML import paths were previously determined by NIX_PROFILES. Using
PATH instead allows Qt applications to work under nix-shell without further modification.
This commit is contained in:
Thomas Tuegel 2017-06-16 08:27:05 -05:00
parent dab7700f6c
commit e6cf9b9df0
No known key found for this signature in database
GPG Key ID: 22CBF5249D4B4D59
6 changed files with 26 additions and 27 deletions

View File

@ -1,8 +1,8 @@
Index: qtbase-opensource-src-5.6.1/src/network/kernel/qdnslookup_unix.cpp
Index: qtbase-opensource-src-5.6.2/src/network/kernel/qdnslookup_unix.cpp
===================================================================
--- qtbase-opensource-src-5.6.1.orig/src/network/kernel/qdnslookup_unix.cpp
+++ qtbase-opensource-src-5.6.1/src/network/kernel/qdnslookup_unix.cpp
@@ -78,7 +78,7 @@ static bool resolveLibraryInternal()
--- qtbase-opensource-src-5.6.2.orig/src/network/kernel/qdnslookup_unix.cpp
+++ qtbase-opensource-src-5.6.2/src/network/kernel/qdnslookup_unix.cpp
@@ -83,7 +83,7 @@ static bool resolveLibraryInternal()
if (!lib.load())
#endif
{
@ -11,10 +11,10 @@ Index: qtbase-opensource-src-5.6.1/src/network/kernel/qdnslookup_unix.cpp
if (!lib.load())
return false;
}
Index: qtbase-opensource-src-5.6.1/src/network/kernel/qhostinfo_unix.cpp
Index: qtbase-opensource-src-5.6.2/src/network/kernel/qhostinfo_unix.cpp
===================================================================
--- qtbase-opensource-src-5.6.1.orig/src/network/kernel/qhostinfo_unix.cpp
+++ qtbase-opensource-src-5.6.1/src/network/kernel/qhostinfo_unix.cpp
--- qtbase-opensource-src-5.6.2.orig/src/network/kernel/qhostinfo_unix.cpp
+++ qtbase-opensource-src-5.6.2/src/network/kernel/qhostinfo_unix.cpp
@@ -94,7 +94,7 @@ static bool resolveLibraryInternal()
if (!lib.load())
#endif

View File

@ -6,12 +6,12 @@ Index: qtbase-opensource-src-5.6.2/src/corelib/kernel/qcoreapplication.cpp
QStringList *app_libpaths = new QStringList;
coreappdata()->app_libpaths.reset(app_libpaths);
+ // Add library paths derived from NIX_PROFILES.
+ const QStringList profiles = QFile::decodeName(qgetenv("NIX_PROFILES")).split(' ');
+ const QString plugindir = QStringLiteral(NIXPKGS_QT_PLUGIN_PREFIX);
+ for (const QString &profile: profiles) {
+ if (!profile.isEmpty()) {
+ app_libpaths->append(profile + QDir::separator() + plugindir);
+ // Add library paths derived from PATH
+ const QStringList paths = QFile::decodeName(qgetenv("PATH")).split(':');
+ const QString plugindir = QStringLiteral("../" NIXPKGS_QT_PLUGIN_PREFIX);
+ for (const QString &path: paths) {
+ if (!path.isEmpty()) {
+ app_libpaths->append(QDir::cleanPath(path + QDir::separator() + plugindir));
+ }
+ }
+

View File

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

View File

@ -1,8 +1,8 @@
Index: qtbase-opensource-src-5.6.0/src/corelib/tools/qtimezoneprivate_tz.cpp
Index: qtbase-opensource-src-5.6.2/src/corelib/tools/qtimezoneprivate_tz.cpp
===================================================================
--- qtbase-opensource-src-5.6.0.orig/src/corelib/tools/qtimezoneprivate_tz.cpp
+++ qtbase-opensource-src-5.6.0/src/corelib/tools/qtimezoneprivate_tz.cpp
@@ -62,7 +62,10 @@ typedef QHash<QByteArray, QTzTimeZone> Q
--- qtbase-opensource-src-5.6.2.orig/src/corelib/tools/qtimezoneprivate_tz.cpp
+++ qtbase-opensource-src-5.6.2/src/corelib/tools/qtimezoneprivate_tz.cpp
@@ -64,7 +64,10 @@ typedef QHash<QByteArray, QTzTimeZone> Q
// Parse zone.tab table, assume lists all installed zones, if not will need to read directories
static QTzTimeZoneHash loadTzTimeZones()
{
@ -14,7 +14,7 @@ Index: qtbase-opensource-src-5.6.0/src/corelib/tools/qtimezoneprivate_tz.cpp
if (!QFile::exists(path))
path = QStringLiteral("/usr/lib/zoneinfo/zone.tab");
@@ -560,12 +563,18 @@ void QTzTimeZonePrivate::init(const QByt
@@ -636,12 +639,18 @@ void QTzTimeZonePrivate::init(const QByt
if (!tzif.open(QIODevice::ReadOnly))
return;
} else {

View File

@ -6,12 +6,12 @@ Index: qtdeclarative-opensource-src-5.6.2/src/qml/qml/qqmlimport.cpp
QString installImportsPath = QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath);
addImportPath(installImportsPath);
+ // Add library paths derived from NIX_PROFILES.
+ const QStringList profiles = QFile::decodeName(qgetenv("NIX_PROFILES")).split(' ');
+ const QString qmldir = QStringLiteral(NIXPKGS_QML2_IMPORT_PREFIX);
+ for (const QString &profile: profiles) {
+ if (!profile.isEmpty()) {
+ addImportPath(profile + QDir::separator() + qmldir);
+ // Add import paths derived from PATH
+ const QStringList paths = QFile::decodeName(qgetenv("PATH")).split(':');
+ const QString qmldir = QStringLiteral("../" NIXPKGS_QML2_IMPORT_PREFIX);
+ for (const QString &path: paths) {
+ if (!path.isEmpty()) {
+ addImportPath(QDir::cleanPath(path + QDir::separator() + qmldir));
+ }
+ }
+

View File

@ -1 +1 @@
nix-profiles-import-paths.patch
import-paths.patch