<commit_before>require 'formula'

class Gtkx3 < Formula
  homepage 'http://gtk.org/'
  url 'http://ftp.gnome.org/pub/gnome/sources/gtk+/3.4/gtk+-3.4.4.tar.xz'
  sha256 'f154e460075034da4c0ce89c320025dcd459da2a1fdf32d92a09522eaca242c7'

  depends_on :x11 => '2.5' # needs XInput2, introduced in libXi 1.3
  depends_on 'pkg-config' => :build
  depends_on 'xz' => :build
  depends_on 'glib'
  depends_on 'jpeg'
  depends_on 'libtiff'
  depends_on 'gdk-pixbuf'
  depends_on 'pango'
  depends_on 'cairo' # for cairo-gobject; XQuartz includes it, but it's broken as of 2.7.2
  depends_on 'jasper' => :optional
  depends_on 'atk' => :optional

  def install
    system "./configure", "--disable-debug",
                          "--disable-dependency-tracking",
                          "--prefix=#{prefix}",
                          "--disable-glibtest",
                          "--disable-introspection"
    system "make install"
  end

  def test
    system "#{bin}/gtk3-demo"<commit_msg>gtk+3: always use our cairo<commit_after>require 'formula'

class Gtkx3 < Formula
  homepage 'http://gtk.org/'
  url 'http://ftp.gnome.org/pub/gnome/sources/gtk+/3.4/gtk+-3.4.4.tar.xz'
  sha256 'f154e460075034da4c0ce89c320025dcd459da2a1fdf32d92a09522eaca242c7'

  depends_on :x11 => '2.5' # needs XInput2, introduced in libXi 1.3
  depends_on 'pkg-config' => :build
  depends_on 'xz' => :build
  depends_on 'glib'
  depends_on 'jpeg'
  depends_on 'libtiff'
  depends_on 'gdk-pixbuf'
  depends_on 'pango'
  depends_on 'cairo'
  depends_on 'jasper' => :optional
  depends_on 'atk' => :optional

  def install
    # Always prefer our cairo over XQuartz cairo
    cairo = Formula.factory('cairo')
    ENV['CAIRO_BACKEND_CFLAGS'] = "-I#{cairo.include}/cairo"
    ENV['CAIRO_BACKEND_LIBS'] = "-L#{cairo.lib} -lcairo"

    system "./configure", "--disable-debug",
                          "--disable-dependency-tracking",
                          "--prefix=#{prefix}",
                          "--disable-glibtest",
                          "--disable-introspection"
    system "make install"
  end

  def test
    system "#{bin}/gtk3-demo"
{'fraction_non_alphanumeric': 0.1383529411764706, 'fraction_numerical': 0.05552941176470588, 'mean_word_length': 2.6033898305084744, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1150582', 'n_tokens_mistral': 851, 'n_tokens_neox': 782, 'n_words': 150}