<commit_before>require "formula"

class Getdns < Formula
  homepage "http://getdnsapi.net"
  url "http://getdnsapi.net/dist/getdns-0.1.4.tar.gz"
  sha1 "9833f96cf23c845008405cec411c1f2005e40dc3"

  bottle do
    sha1 "efad47ff71c7205beb6ab03c133853909031c538" => :mavericks
    sha1 "860489f9eab66b247e32e8a960e0960a1d0109f0" => :mountain_lion
    sha1 "7bdfa25a8aa1c9729dda8cfb1f106aea1a9e1aba" => :lion
  end

  depends_on "ldns"
  depends_on "unbound"
  depends_on "libidn"
  depends_on "libevent" => :optional
  depends_on "libuv" => :optional
  depends_on "libev" => :optional

  def install
    args = []
    args << "--with-libevent" if build.with? "libevent"
    args << "--with-libev" if build.with? "libev"
    args << "--with-libuv" if build.with? "libuv"

    system "./configure", "--prefix=#{prefix}", *args
    system "make", "install"
  end

  test do
    (testpath/"test.c").write <<-EOS.undent
      #include <getdns/getdns.h>

      int main(int argc, char *argv[]) {
        getdns_context *context;
        getdns_dict *api_info;<commit_msg>getdns: add HEAD.<commit_after>require "formula"

class Getdns < Formula
  homepage "http://getdnsapi.net"
  url "http://getdnsapi.net/dist/getdns-0.1.4.tar.gz"
  sha1 "9833f96cf23c845008405cec411c1f2005e40dc3"

  head "https://github.com/getdnsapi/getdns.git"

  bottle do
    sha1 "efad47ff71c7205beb6ab03c133853909031c538" => :mavericks
    sha1 "860489f9eab66b247e32e8a960e0960a1d0109f0" => :mountain_lion
    sha1 "7bdfa25a8aa1c9729dda8cfb1f106aea1a9e1aba" => :lion
  end

  depends_on "ldns"
  depends_on "unbound"
  depends_on "libidn"
  depends_on "libevent" => :optional
  depends_on "libuv" => :optional
  depends_on "libev" => :optional

  def install
    args = []
    args << "--with-libevent" if build.with? "libevent"
    args << "--with-libev" if build.with? "libev"
    args << "--with-libuv" if build.with? "libuv"

    system "./configure", "--prefix=#{prefix}", *args
    system "make", "install"
  end

  test do
    (testpath/"test.c").write <<-EOS.undent
      #include <getdns/getdns.h>

      int main(int argc, char *argv[]) {
        getdns_context *context;
        getdns_dict *api_info;
{'fraction_non_alphanumeric': 0.13911845730027547, 'fraction_numerical': 0.09733700642791551, 'mean_word_length': 3.5873684210526315, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 17, 'https://': 1, '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': '3694205', 'n_tokens_mistral': 1007, 'n_tokens_neox': 903, 'n_words': 161}