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 | 121 |
1 files changed, 80 insertions, 41 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 ffa0a95be2c0..35410d55e66d 100644 --- a/pkgs/development/libraries/qt-5/5.5/qtbase/default.nix +++ b/pkgs/development/libraries/qt-5/5.5/qtbase/default.nix @@ -1,10 +1,11 @@ -{ stdenv, lib, fetchurl, copyPathsToStore, makeWrapper +{ stdenv, lib, fetchurl, copyPathsToStore, fixQtModuleCMakeConfig , srcs , xlibs, libX11, libxcb, libXcursor, libXext, libXrender, libXi , xcbutil, xcbutilimage, xcbutilkeysyms, xcbutilwm, libxkbcommon -, fontconfig, freetype, openssl, dbus, glib, udev, libxml2, libxslt, pcre16 -, zlib, libjpeg, libpng, libtiff, sqlite, icu, harfbuzz +, fontconfig, freetype, harfbuzz +, openssl, dbus, glib, udev, libxml2, libxslt, pcre16 +, zlib, libjpeg, libpng, libtiff, sqlite, icu , coreutils, bison, flex, gdb, gperf, lndir, ruby , python, perl, pkgconfig @@ -14,8 +15,7 @@ , mysql ? null, postgresql ? null # options -, mesaSupported, mesa, mesa_glu -, buildDocs ? false +, mesaSupported, mesa , buildExamples ? false , buildTests ? false , developerBuild ? false @@ -43,6 +43,8 @@ stdenv.mkDerivation { sourceRoot = "qt-everywhere-opensource-src-${version}"; + outputs = [ "dev" "out" ]; + postUnpack = '' mv qtbase-opensource-src-${version} ./qt-everywhere-opensource-src-${version}/qtbase ''; @@ -70,44 +72,68 @@ 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 "@gnome_vfs@" "${gnome_vfs}" \ - --replace "@libgnomeui@" "${libgnomeui}" \ - --replace "@gconf@" "${GConf}" + --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 \ - --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 "; @@ -184,40 +210,53 @@ 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 = [ + dbus glib libxml2 libxslt openssl pcre16 sqlite udev zlib + + # Image formats + libjpeg libpng libtiff + + # Text rendering + fontconfig freetype harfbuzz icu + + # X11 libs xlibs.libXcomposite libX11 libxcb libXext libXrender libXi - fontconfig freetype openssl dbus.libs glib udev libxml2 libxslt pcre16 - zlib libjpeg libpng libtiff sqlite icu harfbuzz 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.out libgnomeui.out 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; @@ -226,9 +265,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; }; |