diff options
Diffstat (limited to 'pkgs/development/libraries/qt-5/5.5/qtbase/default.nix')
-rw-r--r-- | pkgs/development/libraries/qt-5/5.5/qtbase/default.nix | 73 |
1 files changed, 47 insertions, 26 deletions
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 7d68116d716..2cd129acab1 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,24 +100,12 @@ stdenv.mkDerivation { --replace "@mesa_inc@" "${mesa.dev}" ''; + setOutputFlags = false; preConfigure = '' export LD_LIBRARY_PATH="$PWD/qtbase/lib:$PWD/qtbase/plugins/platforms:$LD_LIBRARY_PATH" export MAKEFLAGS=-j$NIX_BUILD_CORES - _multioutQtDevs() { - # We cannot simply set these paths in configureFlags because libQtCore retains - # references to the paths it was built with. - moveToOutput "bin" "$dev" - moveToOutput "include" "$dev" - moveToOutput "mkspecs" "$dev" - - # The destination directory must exist or moveToOutput will do nothing - mkdir -p "$dev/share" - moveToOutput "share/doc" "$dev" - } - preFixupHooks+=(_multioutQtDevs) - configureFlags+="\ -plugindir $out/lib/qt5/plugins \ -importdir $out/lib/qt5/imports \ @@ -230,11 +212,50 @@ 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"; + preFixup = '' + # We cannot simply set these paths in configureFlags because libQtCore retains + # references to the paths it was built with. + moveToOutput "bin" "$dev" + moveToOutput "include" "$dev" + moveToOutput "mkspecs" "$dev" + + # The destination directory must exist or moveToOutput will do nothing + mkdir -p "$dev/share" + moveToOutput "share/doc" "$dev" + + # Move libtool archives and qmake projects + if [ "z''${!outputLib}" != "z''${!outputDev}" ]; then + pushd "''${!outputLib}" + find lib -name '*.a' -o -name '*.la' -o -name '*.prl' | \ + while read -r file; do + mkdir -p "''${!outputDev}/$(dirname "$file")" + mv "''${!outputLib}/$file" "''${!outputDev}/$file" + 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 = '' # Don't retain build-time dependencies like gdb and ruby. |