From e6cf9b9df0dbb8aa2b0db9d797645b2bd4b827ab Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Fri, 16 Jun 2017 08:27:05 -0500 Subject: [PATCH] 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. --- .../libraries/qt-5/5.6/qtbase/dlopen-resolv.patch | 14 +++++++------- ...les-library-paths.patch => library-paths.patch} | 12 ++++++------ pkgs/development/libraries/qt-5/5.6/qtbase/series | 3 +-- .../libraries/qt-5/5.6/qtbase/tzdir.patch | 10 +++++----- ...files-import-paths.patch => import-paths.patch} | 12 ++++++------ .../libraries/qt-5/5.6/qtdeclarative/series | 2 +- 6 files changed, 26 insertions(+), 27 deletions(-) rename pkgs/development/libraries/qt-5/5.6/qtbase/{nix-profiles-library-paths.patch => library-paths.patch} (64%) rename pkgs/development/libraries/qt-5/5.6/qtdeclarative/{nix-profiles-import-paths.patch => import-paths.patch} (64%) diff --git a/pkgs/development/libraries/qt-5/5.6/qtbase/dlopen-resolv.patch b/pkgs/development/libraries/qt-5/5.6/qtbase/dlopen-resolv.patch index a0b546aaa3a..e9d3c2734d1 100644 --- a/pkgs/development/libraries/qt-5/5.6/qtbase/dlopen-resolv.patch +++ b/pkgs/development/libraries/qt-5/5.6/qtbase/dlopen-resolv.patch @@ -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 diff --git a/pkgs/development/libraries/qt-5/5.6/qtbase/nix-profiles-library-paths.patch b/pkgs/development/libraries/qt-5/5.6/qtbase/library-paths.patch similarity index 64% rename from pkgs/development/libraries/qt-5/5.6/qtbase/nix-profiles-library-paths.patch rename to pkgs/development/libraries/qt-5/5.6/qtbase/library-paths.patch index dfc2dccdeb6..fecbce59050 100644 --- a/pkgs/development/libraries/qt-5/5.6/qtbase/nix-profiles-library-paths.patch +++ b/pkgs/development/libraries/qt-5/5.6/qtbase/library-paths.patch @@ -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)); + } + } + diff --git a/pkgs/development/libraries/qt-5/5.6/qtbase/series b/pkgs/development/libraries/qt-5/5.6/qtbase/series index 3527a91c84d..bacb3a4ed89 100644 --- a/pkgs/development/libraries/qt-5/5.6/qtbase/series +++ b/pkgs/development/libraries/qt-5/5.6/qtbase/series @@ -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 diff --git a/pkgs/development/libraries/qt-5/5.6/qtbase/tzdir.patch b/pkgs/development/libraries/qt-5/5.6/qtbase/tzdir.patch index 16e88d7c4f0..f197211ded7 100644 --- a/pkgs/development/libraries/qt-5/5.6/qtbase/tzdir.patch +++ b/pkgs/development/libraries/qt-5/5.6/qtbase/tzdir.patch @@ -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 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 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 { diff --git a/pkgs/development/libraries/qt-5/5.6/qtdeclarative/nix-profiles-import-paths.patch b/pkgs/development/libraries/qt-5/5.6/qtdeclarative/import-paths.patch similarity index 64% rename from pkgs/development/libraries/qt-5/5.6/qtdeclarative/nix-profiles-import-paths.patch rename to pkgs/development/libraries/qt-5/5.6/qtdeclarative/import-paths.patch index 50e9490b6d9..a942d837c30 100644 --- a/pkgs/development/libraries/qt-5/5.6/qtdeclarative/nix-profiles-import-paths.patch +++ b/pkgs/development/libraries/qt-5/5.6/qtdeclarative/import-paths.patch @@ -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)); + } + } + diff --git a/pkgs/development/libraries/qt-5/5.6/qtdeclarative/series b/pkgs/development/libraries/qt-5/5.6/qtdeclarative/series index 7dbe197c56e..38abb916a50 100644 --- a/pkgs/development/libraries/qt-5/5.6/qtdeclarative/series +++ b/pkgs/development/libraries/qt-5/5.6/qtdeclarative/series @@ -1 +1 @@ -nix-profiles-import-paths.patch +import-paths.patch