anchor.diff:  , lzo
   , pixman
   , mesa_noglu
  -#, qt4
   , xorg
   , zlib
  +
  +, gles2 ? false
   }:
   
   with {
     inherit (stdenv.lib)
       enFlag
  -    optionals;
  +    optionals
  +    optionalString;
   };
  +
  +assert xorg != null ->
  +  xorg.libX11 != null
  +  && xorg.libxcb != null
  +  && xorg.libXext != null
  +  && xorg.libXrender != null;
   
   stdenv.mkDerivation rec {
     name = "cairo-1.14.6";
  
positive.code:     "--without-gallium"
    ];
  
    preConfigure =
    /* Work around broken pkg-config `Requires.private' that prevents
       Freetype `-I' cflags from being propagated. */ ''
      sed -i src/cairo.pc.in \
        -e 's|^Cflags:\(.*\)$|Cflags: \1 -I${freetype}/include/freetype2 -I${freetype}/include|g'
    '';
  
    nativeBuildInputs = optionals (!stdenv.cc.isGNU) [
      libiconv
    ];
  
    buildInputs = [
      expat
      fontconfig
      freetype
      glib
      libpng
      libspectre
      lzo
      mesa_noglu
      pixman
      xorg.libX11
      xorg.libxcb
      xorg.libXext
      xorg.libXrender
      xorg.xcbutil
      zlib
    ];
  
    postInstall = ''
      rm -rvf $out/share/gtk-doc
    '' + glib.flattenInclude;
  
    enableParallelBuilding = true;
  
    meta = with stdenv.lib; {
      description = "A vector graphics library with cross-device output support";
  
negative.code:     "--disable-beos"
      "--disable-drm"
      "--disable-gallium"
      (enFlag "libpng" (libpng != null) null)
      # Only one OpenGL backend may be selected at compile time
      # OpenGL X (gl), or OpenGL ES 2.0 (glesv2)
      (enFlag "gl" (!gles2) null)
      (enFlag "glesv2" gles2 null)
      "--disable-cogl" # recursive dependency
      # FIXME: fix directfb mirroring
      "--disable-directfb"
      "--disable-vg"
      (enFlag "egl" (mesa_noglu != null) null)
      (enFlag "glx" (mesa_noglu != null) null)
      "--disable-wgl"
      "--enable-script"
      "--enable-ft"
  