homebrew-core/Formula/knot.rb
2016-01-15 12:48:04 +00:00

103 lines
2.7 KiB
Ruby

class Knot < Formula
desc "High-performance authoritative-only DNS server"
homepage "https://www.knot-dns.cz/"
url "https://secure.nic.cz/files/knot-dns/knot-2.0.2.tar.xz"
sha256 "0418a22f9e801503993b3c872f2403bf73eab5ef7266128789b0531b41ea0c7e"
revision 1
head "https://gitlab.labs.nic.cz/labs/knot.git"
bottle do
cellar :any
sha256 "d50cdf56ab983378103904777db2561f26735b5dd54cec6a8e42b0aca4fd0c40" => :el_capitan
sha256 "f33daf162fb1f7d48eed000c855312a0c5890a13b83bfd91ae4e7b3272e64a5f" => :yosemite
sha256 "f0ad7de6798ae89ce64618345265ea345c404868c869fbaccb9d6060c4329465" => :mavericks
end
depends_on "automake" => :build
depends_on "autoconf" => :build
depends_on "libtool" => :build
depends_on "pkg-config" => :build
depends_on "gnutls"
depends_on "jansson"
depends_on "libidn"
depends_on "nettle"
depends_on "openssl"
depends_on "userspace-rcu"
def install
system "autoreconf", "-i", "-f" if build.head?
system "./configure", "--disable-debug",
"--disable-dependency-tracking",
"--disable-silent-rules",
"--with-configdir=#{etc}",
"--with-storage=#{var}/knot",
"--with-rundir=#{var}/knot",
"--prefix=#{prefix}"
inreplace "samples/Makefile", "install-data-local:", "disable-install-data-local:"
system "make"
system "make", "install"
(buildpath/"knot.conf").write(knot_conf)
etc.install "knot.conf"
(var/"knot").mkpath
end
def knot_conf; <<-EOS.undent
server:
rundir: "#{var}/knot"
listen: [ "0.0.0.0@53", "::@53" ]
log:
- target: "stderr"
any: "error"
- target: "syslog"
server: "info"
zone: "warning"
any: "error"
control:
listen: "knot.sock"
template:
- id: "default"
storage: "#{var}/knot"
EOS
end
plist_options :startup => true
def plist; <<-EOS.undent
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>EnableTransactions</key>
<true/>
<key>Label</key>
<string>#{plist_name}</string>
<key>RunAtLoad</key>
<true/>
<key>ProgramArguments</key>
<array>
<string>#{opt_sbin}/knotd</string>
<string>-c</string>
<string>#{etc}/knot.conf</string>
</array>
<key>ServiceIPC</key>
<false/>
</dict>
</plist>
EOS
end
test do
system "#{bin}/kdig", "www.knot-dns.cz"
system "#{bin}/khost", "brew.sh"
system "#{sbin}/knotc", "-c", "#{etc}/knot.conf", "checkconf"
end
end