anchor.diff:      sha256 = "0lmjlzmghmr27y615px9hkm552x7ap6pmq9mfbzr6smp8y2b6g31";
     };
   
  +  nativeBuildInputs = [
  +    autoreconfHook
  +  ] ++ optionals (!stdenv.cc.isGNU) [
  +    libiconv
  +  ];
  +
  +  buildInputs = [
  +    fontconfig
  +    freetype
  +    glib
  +    libpng
  +    libspectre
  +    lzo
  +    mesa_noglu
  +    pixman
  +    xorg.libX11
  +    xorg.libxcb
  +    xorg.libXext
  +    xorg.libXrender
  +    zlib
  +  ];
  +
  +  patches = [
  +    (fetchTritonPatch {
  +      rev = "082637366675031d5c64f34f3ff866cc965f7c9f";
  +      file = "cairo/cairo-respect-fontconfig.patch";
  +      sha256 = "1732f21adfe5ab291d987b7537b13470266253f599901a4707d27fd2b3d66734";
  +    })
  +    (fetchTritonPatch {
  +      rev = "082637366675031d5c64f34f3ff866cc965f7c9f";
  +      file = "cairo/cairo-1.12.18-disable-test-suite.patch";
  +      sha256 = "3ec119ac2380f8565cebbcea4f745e89eeb78686e76e6b15345a76f05812c254";
  +    })
  +  ];
  +
  +  postPatch =
  +    /* 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'
  +    '' + optionalString (xorg == null)
  +    /* tests and perf tools require Xorg */ ''
  +      sed -i Makefile.am \
  +        -e '/^SUBDIRS/ s#boilerplate test perf# #'
  +    '';
  +
     configureFlags = [
       "--disable-gtk-doc"
       "--disable-gtk-doc-html"
       "--disable-gtk-doc-pdf"
  +    "--enable-largefile"
  +    #"--disable-atomic"
       "--disable-gcov"
       "--disable-valgrind"
  -    "--enable-xlib"
  -    "--enable-xlib-xrender"
  -    "--enable-xcb"
  -    "--enable-xlib-xcb"
  -    "--enable-xcb-shm"
  -    # TODO: qt
  +    (enFlag "xlib" (xorg != null) null)
  +    (enFlag "xlib-xrender" (xorg != null) null)
  +    (enFlag "xcb" (xorg != null) null)
  +    (enFlag "xlib-xcb" (xorg != null) null)
  +    (enFlag "xcb-shm" (xorg != null) null)
       "--disable-qt"
       "--disable-quartz"
       "--disable-quartz-font"
  
positive.code: , lzo
  , pixman
  , mesa_noglu
  #, qt4
  , xorg
  , zlib
  }:
  
  with {
    inherit (stdenv.lib)
      enFlag
      optionals;
  };
  
  stdenv.mkDerivation rec {
    name = "cairo-1.14.6";
  
negative.code:     "--without-gallium"
    ];
  
    postInstall = ''
      rm -rvf $out/share/gtk-doc
    '' + glib.flattenInclude;
  
    meta = with stdenv.lib; {
      description = "A vector graphics library with cross-device output support";
  