From 2ce3fe0a7143737f0f42ddda92676a6169101ae8 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Sat, 15 Apr 2017 11:12:11 -0500 Subject: [PATCH] qt58.qtbase: Fix QT_QPA_PLATFORM_PLUGIN_PATH The default installation path for QPA plugins is appended to QT_QPA_PLATFORM_PLUGIN_PATH, making it unnecessary to wrap some applications and preventing applications from loading platform plugins from the wrong Qt version. --- .../libraries/qt-5/5.8/qtbase/default.nix | 19 ++++++++++++++----- .../qt-5/5.8/qtbase/qpa-plugin-path.patch | 15 +++++++++++++++ .../libraries/qt-5/5.8/qtbase/series | 1 + 3 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 pkgs/development/libraries/qt-5/5.8/qtbase/qpa-plugin-path.patch diff --git a/pkgs/development/libraries/qt-5/5.8/qtbase/default.nix b/pkgs/development/libraries/qt-5/5.8/qtbase/default.nix index be35032785d9..570d61b4420e 100644 --- a/pkgs/development/libraries/qt-5/5.8/qtbase/default.nix +++ b/pkgs/development/libraries/qt-5/5.8/qtbase/default.nix @@ -106,6 +106,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\"" ''; prefixKey = "-prefix "; @@ -227,11 +229,18 @@ stdenv.mkDerivation { nativeBuildInputs = [ bison flex gperf lndir perl pkgconfig python2 ] ++ lib.optional (!stdenv.isDarwin) patchelf; # freetype-2.5.4 changed signedness of some struct fields - NIX_CFLAGS_COMPILE = "-Wno-error=sign-compare" - + lib.optionalString stdenv.isDarwin " -D__MAC_OS_X_VERSION_MAX_ALLOWED=1090 -D__AVAILABILITY_INTERNAL__MAC_10_10=__attribute__((availability(macosx,introduced=10.10)))"; - # Note that nixpkgs's objc4 is from macOS 10.11 while the SDK is - # 10.9 which necessitates the above macro definition that mentions - # 10.10 + NIX_CFLAGS_COMPILE = + [ + "-Wno-error=sign-compare" + ] + ++ lib.optionals stdenv.isDarwin + [ + "-D__MAC_OS_X_VERSION_MAX_ALLOWED=1090" + "-D__AVAILABILITY_INTERNAL__MAC_10_10=__attribute__((availability(macosx,introduced=10.10)))" + # Note that nixpkgs's objc4 is from macOS 10.11 while the SDK is + # 10.9 which necessitates the above macro definition that mentions + # 10.10 + ]; postInstall = '' find "$out" -name "*.cmake" | while read file; do diff --git a/pkgs/development/libraries/qt-5/5.8/qtbase/qpa-plugin-path.patch b/pkgs/development/libraries/qt-5/5.8/qtbase/qpa-plugin-path.patch new file mode 100644 index 000000000000..6d40ed19c00a --- /dev/null +++ b/pkgs/development/libraries/qt-5/5.8/qtbase/qpa-plugin-path.patch @@ -0,0 +1,15 @@ +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; diff --git a/pkgs/development/libraries/qt-5/5.8/qtbase/series b/pkgs/development/libraries/qt-5/5.8/qtbase/series index 2196d8383752..72882a47942c 100644 --- a/pkgs/development/libraries/qt-5/5.8/qtbase/series +++ b/pkgs/development/libraries/qt-5/5.8/qtbase/series @@ -7,3 +7,4 @@ xdg-config-dirs.patch nix-profiles-library-paths.patch compose-search-path.patch libressl.patch +qpa-plugin-path.patch