homebrew-core/Formula/knot.rb

100 lines
2.8 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-3.1.6.tar.xz"
sha256 "e9ba1305d750dc08fb08687aec7ac55737ca073deaa0b867c884e0c0f2fdb753"
license all_of: ["GPL-3.0-or-later", "0BSD", "BSD-3-Clause", "LGPL-2.0-or-later", "MIT"]
livecheck do
url "https://secure.nic.cz/files/knot-dns/"
regex(/href=.*?knot[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
sha256 arm64_monterey: "04f9a237a15e76242fe49aa84c922085e31a05446fc4d2f3c9998fe26eca62da"
sha256 arm64_big_sur: "9185667774b2efa59e5b7980207f93fd4a0cd51159bc4cc2ccdc03fa5670ccb0"
sha256 monterey: "6fef53ea28c513a6c04b3fe3c552dbbb15d84fb29d563c452f1f91de6fb70d79"
sha256 big_sur: "81902e442efb4951e6942b52fd59dba0f377844e41c4c7f683cf59d942695039"
sha256 catalina: "d3b874ab0b17a4fdf32a0e38f31a22b18cfaae8a5b4e7692129746ed4f94514b"
sha256 x86_64_linux: "a57e8cda0c1e803b25636078ef478a82f083912634763d6e83afe7822997414f"
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 "libnghttp2"
depends_on "lmdb"
depends_on "protobuf-c"
depends_on "userspace-rcu"
uses_from_macos "libedit"
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", "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
service do
run opt_sbin/"knotd"
input_path "/dev/null"
log_path "/dev/null"
error_log_path var/"log/knot.log"
end
test do
system bin/"kdig", "www.knot-dns.cz"
system bin/"khost", "brew.sh"
system sbin/"knotc", "conf-check"
end
end