class Knot < Formula desc "High-performance authoritative-only DNS server" homepage "https://www.knot-dns.cz/" revision 1 stable do url "https://secure.nic.cz/files/knot-dns/knot-2.4.0.tar.xz" sha256 "0ba4d3e6951fc4d5c0e3dc88a720462690dd1d25f4bc1e7c24bb5747d3853679" patch do url "https://gitlab.labs.nic.cz/labs/knot/commit/ed5d4421657d7250813a2aae789b75e8baf7468a.patch" sha256 "39167126370786f844394c71ad044ccfd588394c0d2a30e6e57d56e00194d156" end resource "fstrm" do url "https://github.com/farsightsec/fstrm/archive/v0.3.0.tar.gz" sha256 "531ef29ed2a15dfe4993448eb4e8463c5ed8eebf1472a5608c6ac0a6f62b3a12" end end bottle do sha256 "fe6d7e27b906baf9200fb6cd601486efb941b2b740109fa19c24473244fd711b" => :sierra sha256 "47487da57292de21ba02b729fa6315d659bd92681119c4ae032d01d979e60d51" => :el_capitan sha256 "4f8d5a2a490c55eee096241b64ff6a523fabf79555023fd8c4a1bca296fcd789" => :yosemite end head do url "https://gitlab.labs.nic.cz/labs/knot.git" resource "fstrm" do url "https://github.com/farsightsec/fstrm.git" end end # due to AT_REMOVEDIR depends_on :macos => :yosemite depends_on "automake" => :build depends_on "autoconf" => :build depends_on "libtool" => :build 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 "libevent" def install resource("fstrm").stage do system "autoreconf", "-fvi" system "./configure", "--prefix=#{libexec}/fstrm" system "make", "install" end ENV.append "CFLAGS", "-I#{libexec}/fstrm/include" ENV.append "LDFLAGS", "-L#{libexec}/fstrm/lib" ENV.append_path "PKG_CONFIG_PATH", "#{libexec}/fstrm/lib/pkgconfig" 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 ServiceIPC 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