<commit_before>require 'formula'

class PopplerGlib < Requirement
  fatal true

  satisfy :build_env => false do
    Tab.for_formula("poppler").installed_with? "--with-glib"
  end

  def message; <<-EOS.undent
    pdf2svg requires the Poppler-Glib bindings but Poppler was not installed
    with support for glib. Please reinstall Poppler using the `--with-glib`
    option.
    EOS
  end
end

class Pdf2svg < Formula
  url 'http://www.cityinthesky.co.uk/_media/opensource/pdf2svg-0.2.1.tar.gz'
  homepage 'http://www.cityinthesky.co.uk/opensource/pdf2svg'
  sha1 '12f9d1bde6aa2e396eb7f196b6d8e29ade3cafe6'

  depends_on "pkg-config" => :build

  depends_on :x11
  depends_on "poppler"
  depends_on PopplerGlib.new
  depends_on "gtk+"
  depends_on "cairo" # Poppler-glib needs a newer cairo than provided by OS X 10.6.x
                     # and pdf2svg needs it to be on PKG_CONFIG_PATH during the build
  def patches
    # fix call to poppler to render normal thickness lines in firefox
    DATA
  end

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

__END__
--- pdf2svg-0.2.1/pdf2svg.c.ORIG        2008-02-01 10:28:35.000000000 -0800
+++ pdf2svg-0.2.1/pdf2svg.c     2011-11-26 03:56:15.000000000 -0800
@@ -65,7 +65,7 @@
     drawcontext = cairo_create(surface);
 <commit_msg>pdf2svg: depends on poppler with-glib<commit_after>require 'formula'

class Pdf2svg < Formula
  url 'http://www.cityinthesky.co.uk/_media/opensource/pdf2svg-0.2.1.tar.gz'
  homepage 'http://www.cityinthesky.co.uk/opensource/pdf2svg'
  sha1 '12f9d1bde6aa2e396eb7f196b6d8e29ade3cafe6'

  depends_on "pkg-config" => :build

  depends_on :x11
  depends_on "poppler" => "with-glib"
  depends_on "gtk+"
  depends_on "cairo" # Poppler-glib needs a newer cairo than provided by OS X 10.6.x
                     # and pdf2svg needs it to be on PKG_CONFIG_PATH during the build
  def patches
    # fix call to poppler to render normal thickness lines in firefox
    DATA
  end

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

__END__
--- pdf2svg-0.2.1/pdf2svg.c.ORIG        2008-02-01 10:28:35.000000000 -0800
+++ pdf2svg-0.2.1/pdf2svg.c     2011-11-26 03:56:15.000000000 -0800
@@ -65,7 +65,7 @@
     drawcontext = cairo_create(surface);
 
{'fraction_non_alphanumeric': 0.11733001658374792, 'fraction_numerical': 0.08540630182421227, 'mean_word_length': 3.225919439579685, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 4, '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': '4301474', 'n_tokens_mistral': 1004, 'n_tokens_neox': 896, 'n_words': 214}