homebrew-core/Formula/knot.rb
2017-10-20 14:10:54 +01:00

114 lines
3.1 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.6.0.tar.xz"
sha256 "68e04961d0bf6ba193cb7ec658b295c4ff6e60b3754d64bcd77ebdcee0f283fd"
bottle do
sha256 "5d44c9a2feef540ab297d5b26264aa598b0566a918f443ab1e922510f288edd2" => :high_sierra
sha256 "5631458bd695e375fcb579b251b6c1bc15ed67f355cd3b62af6e711041472be8" => :sierra
sha256 "90240b886c02cabe70d4abcd24087333b4e3e69ed1ec9cefb823e4c6130e2070" => :el_capitan
end
head do
url "https://gitlab.labs.nic.cz/knot/knot-dns.git"
depends_on "automake" => :build
depends_on "autoconf" => :build
depends_on "libtool" => :build
end
# due to AT_REMOVEDIR
depends_on :macos => :yosemite
depends_on "pkg-config" => :build
depends_on "sphinx-doc" => :build
depends_on "gnutls"
depends_on "jansson"
depends_on "libidn"
depends_on "nettle"
depends_on "openssl"
depends_on "userspace-rcu"
depends_on "protobuf-c"
depends_on "fstrm"
def install
system "autoreconf", "-fvi" if build.head?
system "./configure", "--disable-dependency-tracking",
"--disable-silent-rules",
"--with-configdir=#{etc}",
"--with-storage=#{var}/knot",
"--with-rundir=#{var}/run/knot",
"--prefix=#{prefix}",
"--with-bash-completions=#{bash_completion}",
"--enable-dnstap"
inreplace "samples/Makefile", "install-data-local:", "disable-install-data-local:"
system "make"
system "make", "check"
system "make", "install"
system "make", "install-singlehtml"
(buildpath/"knot.conf").write(knot_conf)
etc.install "knot.conf"
end
def post_install
(var/"knot").mkpath
end
def knot_conf; <<~EOS
server:
rundir: "#{var}/knot"
listen: [ "0.0.0.0@53", "::@53" ]
log:
- target: "stderr"
any: "info"
control:
listen: "knot.sock"
template:
- id: "default"
storage: "#{var}/knot"
EOS
end
plist_options :startup => true
def plist; <<~EOS
<?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>StandardInPath</key>
<string>/dev/null</string>
<key>StandardOutPath</key>
<string>/dev/null</string>
<key>StandardErrorPath</key>
<string>#{var}/log/knot.log</string>
</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", "conf-check"
end
end