<commit_before>require 'formula'

class Gd < Formula
  homepage 'http://bitbucket.org/pierrejoye/gd-libgd'
  url 'http://www.libgd.org/releases/gd-2.0.36RC1.tar.gz'
  mirror 'http://download.osgeo.org/mapserver/libgd/gd-2.0.36RC1.tar.gz'
  sha1 '21cf2ec93fd80836fc0cb4741201f7cc5440819a'

  head 'http://bitbucket.org/pierrejoye/gd-libgd', :using => :hg

  depends_on :libpng => :recommended
  depends_on 'jpeg' => :recommended
  depends_on 'giflib' => :optional
  depends_on :freetype => :optional

  fails_with :llvm do
    build 2326
    cause "Undefined symbols when linking"
  end

  def install
    args = ["--prefix=#{prefix}"]
    args << "--without-freetype" unless build.with? 'freetype'
    system "./configure", *args
    system "make install"
    (lib+'pkgconfig/gdlib.pc').write pc_file
  end

  def pc_file; <<-EOS.undent
    prefix=#{opt_prefix}
    exec_prefix=${prefix}
    libdir=/${exec_prefix}/lib
    includedir=/${prefix}/include
    bindir=/${prefix}/bin
    ldflags=  -L/${prefix}/lib

    Name: gd<commit_msg>gd: update url<commit_after>require 'formula'

class Gd < Formula
  homepage 'https://bitbucket.org/libgd/gd-libgd'
  # libgd doesn't have their latest (non-alpha) version.
  # When they do release a stable version, use that url.
  # Watch this space: http://libgd.bitbucket.org/pages/downloads.html
  url 'http://download.osgeo.org/mapserver/libgd/gd-2.0.36RC1.tar.gz'
  sha1 '21cf2ec93fd80836fc0cb4741201f7cc5440819a'

  head 'https://bitbucket.org/libgd/gd-libgd', :using => :hg

  depends_on :libpng => :recommended
  depends_on 'jpeg' => :recommended
  depends_on 'giflib' => :optional
  depends_on :freetype => :optional

  fails_with :llvm do
    build 2326
    cause "Undefined symbols when linking"
  end

  def install
    args = ["--prefix=#{prefix}"]
    args << "--without-freetype" unless build.with? 'freetype'
    system "./configure", *args
    system "make install"
    (lib+'pkgconfig/gdlib.pc').write pc_file
  end

  def pc_file; <<-EOS.undent
    prefix=#{opt_prefix}
    exec_prefix=${prefix}
    libdir=/${exec_prefix}/lib
    includedir=/${prefix}/include
    bindir=/${prefix}/bin
    ldflags=  -L/${prefix}/lib

    Name: gd
{'fraction_non_alphanumeric': 0.1473010064043916, 'fraction_numerical': 0.035224153705397984, 'mean_word_length': 3.55625, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 2, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3569217', 'n_tokens_mistral': 850, 'n_tokens_neox': 802, 'n_words': 160}