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.5.3.tar.xz" sha256 "d78ae231a68ace264f5738c8e57481923bcad7413f3f440c06fa6cc0aded9d8e" bottle do sha256 "7b83bcfd808621b1c0b6352d488c16c9108520174e8e3d32db0b228b3de69eb7" => :sierra sha256 "9e22d87d26a20707bad5a32d368bf0416e3f564adfb239ea914fa5a4aeab0615" => :el_capitan sha256 "2a04cadab84f8510ae0bbe96cd0fe2f68fe8658ecadb7d6e868b5d12d2235823" => :yosemite 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.undent 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.undent 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