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.2.tar.xz" sha256 "cb70b2ee1c7ecbaad8774a1e0c449a68c6a6f7c9d60595524f003201d6e38431" bottle do sha256 "135a46329ede38410c4ed016f553db2d839174912758a2c6befa7d4350bbb5a1" => :mojave sha256 "aee994511ac0cd229f9967addc33de1506f8125aedf22a9545b101fca2074df0" => :high_sierra sha256 "bb53f92b3b1ed5c65f0bfe0339a4f4003776efb6b2c34bc7a67615dc06402961" => :sierra sha256 "1aed5ce5f2847b6a8b22e086879142e5c19dd4bd68428dbbcc9a14a7c9653ede" => :el_capitan 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 "libidn" 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 -c #{etc}/knot.conf 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", "-c", etc/"knot.conf", "conf-check" end end