anchor.diff:  
     postInstall = ''
       rm -rf $out/tests
  -  '';
  -
  -  crossAttrs = {
  -    # I've not tried any case other than i686-pc-mingw32.
  -    # -nomake tools:   it fails linking some asian language symbols
  -    # -no-svg: it fails to build on mingw64
  -    configureFlags = ''
  -      -static -release -confirm-license -opensource
  -      -no-opengl -no-phonon
  -      -no-svg
  -      -make qmake -make libs -nomake tools
  -      -nomake demos -nomake examples -nomake docs
  -    '' + optionalString hostPlatform.isMinGW " -xplatform win32-g++-4.6";
  -    patches = [];
  -    preConfigure = ''
  -      sed -i -e 's/ g++/ ${stdenv.cc.targetPrefix}g++/' \
  -        -e 's/ gcc/ ${stdenv.cc.targetPrefix}gcc/' \
  -        -e 's/ ar/ ${stdenv.cc.targetPrefix}ar/' \
  -        -e 's/ strip/ ${stdenv.cc.targetPrefix}strip/' \
  -        -e 's/ windres/ ${stdenv.cc.targetPrefix}windres/' \
  -        mkspecs/win32-g++/qmake.conf
  -    '';
  -
  -    # I don't know why it does not install qmake
  -    postInstall = ''
  -      cp bin/qmake* $out/bin
  -    '';
  -    configurePlatforms = [];
  -    dontStrip = true;
  -  } // optionalAttrs hostPlatform.isMinGW {
  -    propagatedBuildInputs = [ ];
  -  };
  +  ''
  +  # I don't know why it does not install qmake
  +  + lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
  +    cp bin/qmake* $out/bin
  +  '';
  +
  +  dontStrip = if stdenv.hostPlatform == stdenv.buildPlatform then null else true;
   
     meta = {
       homepage    = http://qt-project.org/;
       description = "A cross-platform application framework for C++";
  -    license     = licenses.lgpl21Plus; # or gpl3
  -    maintainers = with maintainers; [ orivej lovek323 phreedom sander ];
  -    platforms   = platforms.unix;
  +    license     = lib.licenses.lgpl21Plus; # or gpl3
  +    maintainers = with lib.maintainers; [ orivej lovek323 phreedom sander ];
  +    platforms   = lib.platforms.unix;
     };
   }
  
positive.code:     substituteInPlace configure --replace /bin/pwd pwd
      substituteInPlace src/corelib/global/global.pri --replace /bin/ls ${coreutils}/bin/ls
      sed -e 's@/\(usr\|opt\)/@/var/empty/@g' -i config.tests/*/*.test -i mkspecs/*/*.conf
    '' + stdenv.lib.optionalString stdenv.isDarwin ''
      # remove impure reference to /usr/lib/libstdc++.6.dylib
      # there might be more references, but this is the only one I could find
      substituteInPlace tools/macdeployqt/tests/tst_deployment_mac.cpp \
        --replace /usr/lib/libstdc++.6.dylib "${stdenv.cc}/lib/libstdc++.6.dylib"
    '' + stdenv.lib.optionalString stdenv.cc.isClang ''
      substituteInPlace src/3rdparty/webkit/Source/WebCore/html/HTMLImageElement.cpp \
        --replace 'optionalHeight > 0' 'optionalHeight != NULL'
  
  
negative.code: 
        -no-phonon ${if buildWebkit then "" else "-no"}-webkit ${if buildMultimedia then "" else "-no"}-multimedia -audio-backend
        ${if developerBuild then "-developer-build" else ""}
      '' else ''
        -static -release -confirm-license -opensource
        -no-opengl -no-phonon
        -no-svg
        -make qmake -make libs -nomake tools
        -nomake demos -nomake examples -nomake docs
      '') + lib.optionalString stdenv.hostPlatform.isDarwin "${platformFlag} unsupported/macx-clang-libc++"
          + lib.optionalString stdenv.hostPlatform.isMinGW  "${platformFlag} win32-g++-4.6";
  
    propagatedBuildInputs =
      [ libXrender libXrandr libXinerama libXcursor libXext libXfixes libXv libXi
        libSM zlib libpng openssl dbus freetype fontconfig glib ]
          # 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.optional libGLSupported libGLU
      ++ lib.optional ((buildWebkit || buildMultimedia) && stdenv.isLinux ) alsaLib
      ++ lib.optionals (buildWebkit || buildMultimedia) [ gstreamer gst-plugins-base ];
  
    # The following libraries are only used in plugins
    buildInputs =
      [ cups # Qt dlopen's libcups instead of linking to it
        postgresql sqlite libjpeg libmng libtiff icu ]
      ++ lib.optionals (mysql != null) [ mysql.connector-c ]
      ++ lib.optionals gtkStyle [ gtk2 gdk_pixbuf ]
      ++ lib.optionals stdenv.isDarwin [ cf-private ApplicationServices OpenGL Cocoa AGL libcxx libobjc ];
  
    nativeBuildInputs = [ perl pkgconfig which ];
  
  