diff --git a/pkgs/development/libraries/qt-5/5.5/qtbase/default.nix b/pkgs/development/libraries/qt-5/5.5/qtbase/default.nix index f2071fa6f8fc..2cd129acab1d 100644 --- a/pkgs/development/libraries/qt-5/5.5/qtbase/default.nix +++ b/pkgs/development/libraries/qt-5/5.5/qtbase/default.nix @@ -8,7 +8,7 @@ , zlib, libjpeg, libpng, libtiff, sqlite, icu , coreutils, bison, flex, gdb, gperf, lndir, ruby -, python, perl, pkgconfig +, patchelf, perl, pkgconfig, python # optional dependencies , cups ? null @@ -19,7 +19,7 @@ , buildExamples ? false , buildTests ? false , developerBuild ? false -, gtkStyle ? false, libgnomeui, GConf, gnome_vfs, gtk +, gtkStyle ? true, libgnomeui, GConf, gnome_vfs, gtk , decryptSslTraffic ? false }: @@ -27,6 +27,9 @@ let inherit (srcs.qt5) version; system-x86_64 = lib.elem stdenv.system lib.platforms.x86_64; + # Search path for Gtk plugin + gtkLibPath = lib.makeLibraryPath [ gtk.out gnome_vfs.out libgnomeui.out GConf.out ]; + dontInvalidateBacking = fetchurl { url = "https://codereview.qt-project.org/gitweb?p=qt/qtbase.git;a=patch;h=0f68f8920573cdce1729a285a92ac8582df32841;hp=24c50f8dcf7fa61ac3c3d4d6295c259a104a2b8c"; name = "qtbug-48321-dont-invalidate-backing-store.patch"; @@ -43,7 +46,7 @@ stdenv.mkDerivation { sourceRoot = "qt-everywhere-opensource-src-${version}"; - outputs = [ "dev" "out" ]; + outputs = [ "dev" "out" "gtk" ]; postUnpack = '' mv qtbase-opensource-src-${version} ./qt-everywhere-opensource-src-${version}/qtbase @@ -51,7 +54,6 @@ stdenv.mkDerivation { patches = copyPathsToStore (lib.readPathsFromFile ./. ./series) - ++ lib.optional gtkStyle ./dlopen-gtkstyle.patch ++ lib.optional decryptSslTraffic ./decrypt-ssl-traffic.patch ++ lib.optional mesaSupported [ ./dlopen-gl.patch ./mkspecs-libgl.patch ]; @@ -89,14 +91,6 @@ stdenv.mkDerivation { qtbase/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp \ --replace "@libX11@" "${libX11.out}" '' - + lib.optionalString gtkStyle '' - substituteInPlace qtbase/src/widgets/styles/qgtk2painter.cpp --replace "@gtk@" "${gtk.out}" - substituteInPlace qtbase/src/widgets/styles/qgtkstyle_p.cpp \ - --replace "@gtk@" "${gtk.out}" \ - --replace "@gnome_vfs@" "${gnome_vfs.out}" \ - --replace "@libgnomeui@" "${libgnomeui.out}" \ - --replace "@gconf@" "${GConf.out}" - '' + lib.optionalString mesaSupported '' substituteInPlace \ qtbase/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp \ @@ -106,6 +100,7 @@ stdenv.mkDerivation { --replace "@mesa_inc@" "${mesa.dev}" ''; + setOutputFlags = false; preConfigure = '' export LD_LIBRARY_PATH="$PWD/qtbase/lib:$PWD/qtbase/plugins/platforms:$LD_LIBRARY_PATH" @@ -217,7 +212,7 @@ stdenv.mkDerivation { ++ lib.optional (postgresql != null) postgresql ++ lib.optionals gtkStyle [gnome_vfs.out libgnomeui.out gtk GConf]; - nativeBuildInputs = [ fixQtModuleCMakeConfig lndir python perl pkgconfig ]; + nativeBuildInputs = [ fixQtModuleCMakeConfig lndir patchelf perl pkgconfig python ]; # freetype-2.5.4 changed signedness of some struct fields NIX_CFLAGS_COMPILE = "-Wno-error=sign-compare"; @@ -243,6 +238,22 @@ stdenv.mkDerivation { done popd fi + + # Move the QGtkStyle plugin to the gtk output + mkdir -p "$gtk/lib/qt5/plugins/platformthemes" + mv "$out/lib/qt5/plugins/platformthemes/libqgtk2.so" "$gtk/lib/qt5/plugins/platformthemes" + rm "$out/lib/cmake/Qt5Gui/Qt5Gui_QGtk2ThemePlugin.cmake" + + # Set RPATH for QGtkStyle plugin + qgtk2="$gtk/lib/qt5/plugins/platformthemes/libqgtk2.so" + qgtk2_RPATH="$(patchelf --print-rpath "$qgtk2")" + qgtk2_RPATH="$qgtk2_RPATH''${qgtk2_RPATH:+:}${gtkLibPath}" + patchelf "$qgtk2" \ + --add-needed libgtk-x11-2.0.so \ + --add-needed libgnomeui-2.so \ + --add-needed libgnomevfs-2.so \ + --add-needed libgconf-2.so \ + --set-rpath "$qgtk2_RPATH" ''; postFixup =