<commit_before>require 'formula'

def glib?; ARGV.include? "--with-glib"; end

class PopplerData < Formula
  url 'http://poppler.freedesktop.org/poppler-data-0.4.4.tar.gz'
  md5 'f3a1afa9218386b50ffd262c00b35b31'
end

class Poppler < Formula
  url 'http://poppler.freedesktop.org/poppler-0.16.6.tar.gz'
  homepage 'http://poppler.freedesktop.org/'
  md5 '592a564fb7075a845f75321ed6425424'

  depends_on 'pkg-config' => :build
  depends_on "qt" if ARGV.include? "--with-qt4"
  depends_on 'cairo' if glib? # Needs a newer Cairo build than OS X 10.6.7 provides

  def options
    [
      ["--with-qt4", "Build Qt backend"],
      ["--with-glib", "Build Glib backend"],
      ["--enable-xpdf-headers", "Also install XPDF headers"]
    ]
  end

  def install
    ENV.x11 # For Fontconfig headers

    if ARGV.include? "--with-qt4"
      ENV['POPPLER_QT4_CFLAGS'] = `#{HOMEBREW_PREFIX}/bin/pkg-config QtCore QtGui --libs`.chomp.strip
      ENV.append 'LDFLAGS', "-Wl,-F#{HOMEBREW_PREFIX}/lib"
    end

    args = ["--disable-dependency-tracking", "--prefix=#{prefix}"]
    args << "--disable-poppler-qt4" unless ARGV.include? "--with-qt4"
    args << "--disable-poppler-glib" unless glib?
    args << "--enable-xpdf-headers" if ARGV.include? "--enable-xpdf-headers"

    system "./configure", *args
    system "make install"

    # Install poppler font data.
    PopplerData.new.brew do
      system "make install prefix=#{prefix}"
    end
  end
end<commit_msg>Poppler: Actually depend on Glib if requested<commit_after>require 'formula'

def glib?; ARGV.include? "--with-glib"; end

class PopplerData < Formula
  url 'http://poppler.freedesktop.org/poppler-data-0.4.4.tar.gz'
  md5 'f3a1afa9218386b50ffd262c00b35b31'
end

class Poppler < Formula
  url 'http://poppler.freedesktop.org/poppler-0.16.6.tar.gz'
  homepage 'http://poppler.freedesktop.org/'
  md5 '592a564fb7075a845f75321ed6425424'

  depends_on 'pkg-config' => :build
  depends_on 'qt' if ARGV.include? "--with-qt4"
  depends_on 'glib' if glib?
  depends_on 'cairo' if glib? # Needs a newer Cairo build than OS X 10.6.7 provides

  def options
    [
      ["--with-qt4", "Build Qt backend"],
      ["--with-glib", "Build Glib backend"],
      ["--enable-xpdf-headers", "Also install XPDF headers"]
    ]
  end

  def install
    ENV.x11 # For Fontconfig headers

    if ARGV.include? "--with-qt4"
      ENV['POPPLER_QT4_CFLAGS'] = `#{HOMEBREW_PREFIX}/bin/pkg-config QtCore QtGui --libs`.chomp.strip
      ENV.append 'LDFLAGS', "-Wl,-F#{HOMEBREW_PREFIX}/lib"
    end

    args = ["--disable-dependency-tracking", "--prefix=#{prefix}"]
    args << "--enable-poppler-qt4" if ARGV.include? "--with-qt4"
    args << "--enable-poppler-glib" if glib?
    args << "--enable-xpdf-headers" if ARGV.include? "--enable-xpdf-headers"

    system "./configure", *args
    system "make install"

    # Install poppler font data.
    PopplerData.new.brew do
      system "make install prefix=#{prefix}"
    end
  end
end
{'fraction_non_alphanumeric': 0.15467747382641, 'fraction_numerical': 0.044579533941236066, 'mean_word_length': 3.1659634317862166, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 5, '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': '4376156', 'n_tokens_mistral': 1185, 'n_tokens_neox': 1085, 'n_words': 241}