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.7.6.tar.xz" sha256 "a1cb1877f04f7c2549c977c2658cfafd07c7e0e924f8e8aa8d4ae4b707f697a2" bottle do sha256 "a4aada91becc36fed0c3b9416325b4e31bde2bcd6954fa5ccf284f341ed01ccf" => :mojave sha256 "9e56321341856b71fa43a724274a64b42ef75c434a9a9eec141e065252418489" => :high_sierra sha256 "a647a0de0f7879a0d3d0e7b71d2713b7cfde7df9b038d9f714cb91c46d5fc95d" => :sierra end head do url "https://gitlab.labs.nic.cz/knot/knot-dns.git" depends_on "autoconf" => :build depends_on "automake" => :build depends_on "libtool" => :build end depends_on "pkg-config" => :build depends_on "sphinx-doc" => :build depends_on "fstrm" depends_on "gnutls" depends_on "libidn2" depends_on :macos => :yosemite # due to AT_REMOVEDIR depends_on "protobuf-c" depends_on "userspace-rcu" 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-module-dnstap", "--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 EnableTransactions Label #{plist_name} RunAtLoad ProgramArguments #{opt_sbin}/knotd StandardInPath /dev/null StandardOutPath /dev/null StandardErrorPath #{var}/log/knot.log EOS end test do system bin/"kdig", "www.knot-dns.cz" system bin/"khost", "brew.sh" system sbin/"knotc", "conf-check" end end