anchor.diff:      ++ optional withGraphite2 graphite2
       ++ optionals withIcu [ icu harfbuzz ];
   
  -  checkInputs = [ python ];
  -  doInstallCheck = false; # fails, probably a bug
  +  doCheck = true;
   
     # Slightly hacky; some pkgs expect them in a single directory.
  -  postInstall = optionalString withIcu ''
  +  postFixup = optionalString withIcu ''
       rm "$out"/lib/libharfbuzz.* "$dev/lib/pkgconfig/harfbuzz.pc"
       ln -s {'${harfbuzz.out}',"$out"}/lib/libharfbuzz.la
       ln -s {'${harfbuzz.dev}',"$dev"}/lib/pkgconfig/harfbuzz.pc
  
positive.code:       --replace '#pragma GCC diagnostic error   "-Wcast-align"' ""
    '';
  
    outputs = [ "out" "dev" ];
    outputBin = "dev";
  
    configureFlags = [
      # not auto-detected by default
      "--with-graphite2=${if withGraphite2 then "yes" else "no"}"
      "--with-icu=${if withIcu then "yes" else "no"}"
      "--with-gobject=yes"
      "--enable-introspection=yes"
    ]
      ++ stdenv.lib.optional withCoreText "--with-coretext=yes";
  
    nativeBuildInputs = [
      gobject-introspection
      libintl
      pkgconfig
    ];
  
    buildInputs = [ glib freetype cairo ] # recommended by upstream
  
negative.code: 
    meta = with stdenv.lib; {
      description = "An OpenType text shaping engine";
      homepage = "https://harfbuzz.github.io/";
      maintainers = [ maintainers.eelco ];
      license = licenses.mit;
      platforms = with platforms; linux ++ darwin;
    };
  }
  