2014-02-26 18:53:48 +00:00
|
|
|
class Getdns < Formula
|
2015-05-19 00:00:59 +00:00
|
|
|
desc "Modern asynchronous DNS API"
|
2015-06-02 22:38:29 +00:00
|
|
|
homepage "https://getdnsapi.net"
|
2015-11-01 03:38:56 +00:00
|
|
|
url "https://getdnsapi.net/dist/getdns-0.5.0.tar.gz"
|
|
|
|
sha256 "b0680170249ba9987b8af4c7f2bc64833fe6396ecd66565c991b33775f78ccdb"
|
2014-02-26 18:53:48 +00:00
|
|
|
|
2014-12-15 09:19:41 +00:00
|
|
|
head "https://github.com/getdnsapi/getdns.git"
|
|
|
|
|
2014-03-25 14:58:59 +00:00
|
|
|
bottle do
|
2015-06-03 13:51:01 +00:00
|
|
|
cellar :any
|
2015-11-01 05:30:17 +00:00
|
|
|
sha256 "3cd3d254095f1e763cceb1ee1aa143392f545e6db695e2f42e01e4d6d03f3603" => :el_capitan
|
|
|
|
sha256 "944dfc0254806c44beb2f731caa5a670b273c8363c2cfe19db17ca895afbf333" => :yosemite
|
|
|
|
sha256 "aef42eabcbcfcbcf9c7d416c9d607da580e6447a08b61088d6bd5a9ffc7c9fbe" => :mavericks
|
2014-03-25 14:58:59 +00:00
|
|
|
end
|
|
|
|
|
2015-06-02 22:38:29 +00:00
|
|
|
depends_on "openssl"
|
2014-02-26 18:53:48 +00:00
|
|
|
depends_on "unbound"
|
|
|
|
depends_on "libidn"
|
2014-04-01 15:45:36 +00:00
|
|
|
depends_on "libevent" => :optional
|
2014-02-26 18:53:48 +00:00
|
|
|
depends_on "libuv" => :optional
|
2014-04-01 15:45:36 +00:00
|
|
|
depends_on "libev" => :optional
|
2014-02-26 18:53:48 +00:00
|
|
|
|
|
|
|
def install
|
2015-06-02 22:38:29 +00:00
|
|
|
args = [
|
|
|
|
"--with-ssl=#{Formula["openssl"].opt_prefix}",
|
2015-11-01 03:38:56 +00:00
|
|
|
"--with-trust-anchor=#{etc}/getdns-root.key",
|
2015-06-02 22:38:29 +00:00
|
|
|
]
|
2014-04-01 15:45:36 +00:00
|
|
|
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
|
2014-02-26 18:53:48 +00:00
|
|
|
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;
|
|
|
|
char *pp;
|
|
|
|
getdns_return_t r = getdns_context_create(&context, 0);
|
|
|
|
if (r != GETDNS_RETURN_GOOD) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
api_info = getdns_context_get_api_information(context);
|
|
|
|
if (!api_info) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
pp = getdns_pretty_print_dict(api_info);
|
|
|
|
if (!pp) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
puts(pp);
|
2014-03-25 14:55:22 +00:00
|
|
|
free(pp);
|
2014-02-26 18:53:48 +00:00
|
|
|
getdns_dict_destroy(api_info);
|
|
|
|
getdns_context_destroy(context);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EOS
|
2015-11-01 03:38:56 +00:00
|
|
|
system ENV.cc, "-I#{include}", "-o", "test", "test.c", "-L#{lib}", "-lgetdns"
|
2014-02-26 18:53:48 +00:00
|
|
|
system "./test"
|
|
|
|
end
|
|
|
|
end
|