about summary refs log tree commit diff
path: root/pkgs/development/libraries/qt-5/5.4/qtbase/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/libraries/qt-5/5.4/qtbase/default.nix')
-rw-r--r--pkgs/development/libraries/qt-5/5.4/qtbase/default.nix101
1 files changed, 66 insertions, 35 deletions
diff --git a/pkgs/development/libraries/qt-5/5.4/qtbase/default.nix b/pkgs/development/libraries/qt-5/5.4/qtbase/default.nix
index 36bd3822bf73..0585601db765 100644
--- a/pkgs/development/libraries/qt-5/5.4/qtbase/default.nix
+++ b/pkgs/development/libraries/qt-5/5.4/qtbase/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, lib, fetchurl, copyPathsToStore, makeWrapper
+{ stdenv, lib, fetchurl, copyPathsToStore, fixQtModuleCMakeConfig
 , srcs
 
 , xlibs, libX11, libxcb, libXcursor, libXext, libXrender, libXi
@@ -14,8 +14,7 @@
 , mysql ? null, postgresql ? null
 
 # options
-, mesaSupported, mesa, mesa_glu
-, buildDocs ? false
+, mesaSupported, mesa
 , buildExamples ? false
 , buildTests ? false
 , developerBuild ? false
@@ -37,6 +36,8 @@ stdenv.mkDerivation {
 
   sourceRoot = "qt-everywhere-opensource-src-${version}";
 
+  outputs = [ "dev" "out" ];
+
   postUnpack = ''
     mv qtbase-opensource-src-${version} ./qt-everywhere-opensource-src-${version}/qtbase
   '';
@@ -60,27 +61,27 @@ stdenv.mkDerivation {
       sed -i 's/PATHS.*NO_DEFAULT_PATH//' "qtbase/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in"
 
       substituteInPlace qtbase/src/network/kernel/qdnslookup_unix.cpp \
-        --replace "@glibc@" "${stdenv.cc.libc}"
+        --replace "@glibc@" "${stdenv.cc.libc.out}"
       substituteInPlace qtbase/src/network/kernel/qhostinfo_unix.cpp \
-        --replace "@glibc@" "${stdenv.cc.libc}"
+        --replace "@glibc@" "${stdenv.cc.libc.out}"
 
       substituteInPlace qtbase/src/plugins/platforms/xcb/qxcbcursor.cpp \
-        --replace "@libXcursor@" "${libXcursor}"
+        --replace "@libXcursor@" "${libXcursor.out}"
 
       substituteInPlace qtbase/src/network/ssl/qsslsocket_openssl_symbols.cpp \
-        --replace "@openssl@" "${openssl}"
+        --replace "@openssl@" "${openssl.out}"
 
       substituteInPlace qtbase/src/dbus/qdbus_symbols.cpp \
-        --replace "@dbus_libs@" "${dbus}"
+        --replace "@dbus_libs@" "${dbus.lib}"
 
       substituteInPlace \
         qtbase/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp \
-        --replace "@libX11@" "${libX11}"
+        --replace "@libX11@" "${libX11.out}"
     ''
     + lib.optionalString gtkStyle ''
-      substituteInPlace qtbase/src/widgets/styles/qgtk2painter.cpp --replace "@gtk@" "${gtk}"
+      substituteInPlace qtbase/src/widgets/styles/qgtk2painter.cpp --replace "@gtk@" "${gtk.out}"
       substituteInPlace qtbase/src/widgets/styles/qgtkstyle_p.cpp \
-        --replace "@gtk@" "${gtk}" \
+        --replace "@gtk@" "${gtk.out}" \
         --replace "@gnome_vfs@" "${gnome_vfs}" \
         --replace "@libgnomeui@" "${libgnomeui}" \
         --replace "@gconf@" "${GConf}"
@@ -88,16 +89,40 @@ stdenv.mkDerivation {
     + lib.optionalString mesaSupported ''
       substituteInPlace \
         qtbase/src/plugins/platforms/xcb/qglxintegration.cpp \
-        --replace "@mesa@" "${mesa}"
-      substituteInPlace qtbase/mkspecs/common/linux.conf --replace "@mesa@" "${mesa}"
+        --replace "@mesa_lib@" "${mesa.out}"
+      substituteInPlace qtbase/mkspecs/common/linux.conf \
+        --replace "@mesa_lib@" "${mesa.out}" \
+        --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
 
-    export configureFlags+="-plugindir $out/lib/qt5/plugins -importdir $out/lib/qt5/imports -qmldir $out/lib/qt5/qml"
-    export configureFlags+=" -docdir $out/share/doc/qt5"
+    _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"
+
+        mkdir -p "$dev/lib"
+        lndir -silent "$out/lib" "$dev/lib"
+        if [[ -h "$dev/lib/cmake" ]]; then rm "$dev/lib/cmake"; fi
+        if [[ -h "$dev/lib/pkgconfig" ]]; then rm "$dev/lib/pkgconfig"; fi
+    }
+    preFixupHooks+=(_multioutQtDevs)
+
+    configureFlags+="\
+        -plugindir $out/lib/qt5/plugins \
+        -importdir $out/lib/qt5/imports \
+        -qmldir $out/lib/qt5/qml \
+        -docdir $out/share/doc/qt5"
   '';
 
   prefixKey = "-prefix ";
@@ -172,40 +197,46 @@ stdenv.mkDerivation {
   # PostgreSQL autodetection fails sporadically because Qt omits the "-lpq" flag
   # if dependency paths contain the string "pq", which can occur in the hash.
   # To prevent these failures, we need to override PostgreSQL detection.
-  PSQL_LIBS = lib.optionalString (postgresql != null) "-L${postgresql}/lib -lpq";
+  PSQL_LIBS = lib.optionalString (postgresql != null) "-L${postgresql.lib}/lib -lpq";
 
   propagatedBuildInputs = [
     xlibs.libXcomposite libX11 libxcb libXext libXrender libXi
-    fontconfig freetype openssl dbus.libs glib udev libxml2 libxslt pcre
+    fontconfig freetype openssl dbus glib udev libxml2 libxslt pcre
     zlib libjpeg libpng libtiff sqlite icu
     xcbutil xcbutilimage xcbutilkeysyms xcbutilwm libxkbcommon
   ]
-  # Qt doesn't directly need GLU (just GL), but many apps use, it's small and
-  # doesn't remain a runtime-dep if not used
-  ++ lib.optionals mesaSupported [ mesa mesa_glu ]
-  ++ lib.optional (cups != null) cups
-  ++ lib.optional (mysql != null) mysql.lib
-  ++ lib.optional (postgresql != null) postgresql
-  ++ lib.optionals gtkStyle [gnome_vfs libgnomeui gtk GConf];
+  ++ lib.optional mesaSupported mesa;
 
   buildInputs =
     [ bison flex gperf ruby ]
-    ++ lib.optional developerBuild gdb;
-
-  nativeBuildInputs = [ python perl pkgconfig ];
+    ++ lib.optional developerBuild gdb
+    ++ lib.optional (cups != null) cups
+    ++ lib.optional (mysql != null) mysql.lib
+    ++ lib.optional (postgresql != null) postgresql
+    ++ lib.optionals gtkStyle [gnome_vfs libgnomeui gtk GConf];
 
-  propagatedNativeBuildInputs = [ makeWrapper ];
+  nativeBuildInputs = [ fixQtModuleCMakeConfig lndir python perl pkgconfig ];
 
   # freetype-2.5.4 changed signedness of some struct fields
   NIX_CFLAGS_COMPILE = "-Wno-error=sign-compare";
 
-  postInstall =
+  postFixup =
     ''
       # Don't retain build-time dependencies like gdb and ruby.
-      sed '/QMAKE_DEFAULT_.*DIRS/ d' -i $out/mkspecs/qconfig.pri
-    ''
-    + lib.optionalString buildDocs ''
-      make docs && make install_docs
+      sed '/QMAKE_DEFAULT_.*DIRS/ d' -i "$dev/mkspecs/qconfig.pri"
+
+      fixQtModuleCMakeConfig "Concurrent"
+      fixQtModuleCMakeConfig "Core"
+      fixQtModuleCMakeConfig "DBus"
+      fixQtModuleCMakeConfig "Gui"
+      fixQtModuleCMakeConfig "Network"
+      fixQtModuleCMakeConfig "OpenGL"
+      fixQtModuleCMakeConfig "OpenGLExtensions"
+      fixQtModuleCMakeConfig "PrintSupport"
+      fixQtModuleCMakeConfig "Sql"
+      fixQtModuleCMakeConfig "Test"
+      fixQtModuleCMakeConfig "Widgets"
+      fixQtModuleCMakeConfig "Xml"
     '';
 
   inherit lndir;
@@ -214,9 +245,9 @@ stdenv.mkDerivation {
   enableParallelBuilding = true;
 
   meta = with lib; {
-    homepage = http://qt-project.org;
+    homepage = http://www.qt.io;
     description = "A cross-platform application framework for C++";
-    license = "GPL/LGPL";
+    license = with licenses; [ fdl13 gpl2 lgpl21 lgpl3 ];
     maintainers = with maintainers; [ bbenoist qknight ttuegel ];
     platforms = platforms.linux;
   };