anchor.diff:      ++ (if withQt5 then [ qmake ] else [ qmake4Hook ])
       ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
   
  -
     patches = lib.optional (stdenv.isDarwin && withQt5) [ xcodePatch ];
   
     enableParallelBuilding = true;
   
  -  preConfigure = ''
  -    cd Qt4Qt5
  -    sed -i qscintilla.pro \
  -      -e "s,\$\$\\[QT_INSTALL_LIBS\\],$out/lib," \
  -      -e "s,\$\$\\[QT_INSTALL_HEADERS\\],$out/include/," \
  -      -e "s,\$\$\\[QT_INSTALL_TRANSLATIONS\\],$out/translations," \
  -    ${if withQt5 then ''
  -      -e "s,\$\$\\[QT_HOST_DATA\\]/mkspecs,$out/mkspecs," \
  -      -e "s,\$\$\\[QT_INSTALL_DATA\\]/mkspecs,$out/mkspecs," \
  -      -e "s,\$\$\\[QT_INSTALL_DATA\\],$out/share,"
  -    '' else ''
  -      -e "s,\$\$\\[QT_INSTALL_DATA\\],$out/share/qt,"
  -    ''}
  +  # By default qscintilla will name the library with a qt version suffix which
  +  # confuses the crap out of sqlitebrowser and possibly others so we simply
  +  # strip the suffix as we don't need it and the various FindQScintilla.cmake
  +  # files floating around *should* look for the un-suffixed version.
  +  postPatch = ''
  +    substituteInPlace qscintilla.pro \
  +      --replace '_qt$''${QT_MAJOR_VERSION}'   "" \
  +      --replace '$$[QT_INSTALL_LIBS]'         $out/lib \
  +      --replace '$$[QT_INSTALL_HEADERS]'      $out/include \
  +      --replace '$$[QT_INSTALL_TRANSLATIONS]' $out/translations \
  +      --replace '$$[QT_HOST_DATA]/mkspecs'    $out/mkspecs \
  +      --replace '$$[QT_INSTALL_DATA]/mkspecs' $out/mkspecs \
  +      --replace '$$[QT_INSTALL_DATA]'         $out/share${lib.optionalString (! withQt5) "/qt"}
     '';
   
     meta = with stdenv.lib; {
  
positive.code: , fixDarwinDylibNames
  }:
  
  # Fix Xcode 8 compilation problem
  let xcodePatch =
    fetchurl { url = "https://raw.githubusercontent.com/Homebrew/formula-patches/a651d71/qscintilla2/xcode-8.patch";
               sha256 = "1a88309fdfd421f4458550b710a562c622d72d6e6fdd697107e4a43161d69bc9"; };
  in
  stdenv.mkDerivation rec {
    pname = "qscintilla";
    version = "2.9.4";
  
    name = "${pname}-${if withQt5 then "qt5" else "qt4"}-${version}";
  
    src = fetchurl {
      url = "mirror://sourceforge/pyqt/QScintilla2/QScintilla-${version}/QScintilla_gpl-${version}.zip";
      sha256 = "04678skipydx68zf52vznsfmll2v9aahr66g50lcqbr6xsmgr1yi";
    };
  
    buildInputs = [ (if withQt5 then qtbase else qt4) ];
  
  
negative.code:       proportional fonts, bold and italics, multiple foreground and
        background colours and multiple fonts.
      '';
      homepage = https://www.riverbankcomputing.com/software/qscintilla/intro;
      license = with licenses; [ gpl2 gpl3 ]; # and commercial
      maintainers = with maintainers; [ peterhoeg ];
      platforms = platforms.unix;
      broken = !withQt5;
    };
  }
  