homebrew-core/Formula/bind.rb

101 lines
3.0 KiB
Ruby

class Bind < Formula
desc "Implementation of the DNS protocols"
homepage "https://www.isc.org/bind/"
# BIND releases with even minor version numbers (9.14.x, 9.16.x, etc) are
# stable. Odd-numbered minor versions are for testing, and can be unstable
# or buggy. They are not suitable for general deployment. We have to use
# "version_scheme" because someone upgraded to 9.15.0, and required a
# downgrade.
url "https://downloads.isc.org/isc/bind9/9.18.0/bind-9.18.0.tar.xz"
sha256 "56525bf5caf01fd8fd9d90910880cc0f8a90a27a97d169187d651d4ecf0c411c"
license "MPL-2.0"
revision 1
version_scheme 1
head "https://gitlab.isc.org/isc-projects/bind9.git", branch: "main"
# BIND indicates stable releases with an even-numbered minor (e.g., x.2.x)
# and the regex below only matches these versions.
livecheck do
url "https://www.isc.org/download/"
regex(/href=.*?bind[._-]v?(\d+\.\d*[02468](?:\.\d+)*)\.t/i)
end
bottle do
sha256 arm64_monterey: "fcf31d918b5942a4be406b59d10a57f7c81bbeee17f8ee4931ddad747ab69c25"
sha256 arm64_big_sur: "d8fbc5c20da3da1d3c8cda33f7b988fa703714104cbd9288c96b786d5c6384b5"
sha256 monterey: "219596d158d6bd69de2be6f42cd9f6e06c4f13bbe69c23c2db9a7f53d6497e7b"
sha256 big_sur: "4b7c6b05b7707c84e8b4e83bd47a618635ae8a2d60b99b7ff188cf8185d0e075"
sha256 catalina: "77c121c141793af106ddd3903fe208f31610b1aefc1e34bc37c66dd0922c7697"
sha256 x86_64_linux: "3395d0c08ba996a1e47b6e7473d002daa630ef0ce42dfb867c692f327044ebb2"
end
depends_on "pkg-config" => :build
depends_on "json-c"
depends_on "libidn2"
depends_on "libnghttp2"
depends_on "libuv"
depends_on "openssl@1.1"
def install
# Fix "configure: error: xml2-config returns badness"
ENV["SDKROOT"] = MacOS.sdk_path if MacOS.version <= :sierra
args = [
"--prefix=#{prefix}",
"--sysconfdir=#{pkgetc}",
"--with-json-c",
"--with-openssl=#{Formula["openssl@1.1"].opt_prefix}",
"--with-libjson=#{Formula["json-c"].opt_prefix}",
"--without-lmdb",
"--with-libidn2=#{Formula["libidn2"].opt_prefix}",
]
args << "--disable-linux-caps" if OS.linux?
system "./configure", *args
system "make"
system "make", "install"
(buildpath/"named.conf").write named_conf
system "#{sbin}/rndc-confgen", "-a", "-c", "#{buildpath}/rndc.key"
pkgetc.install "named.conf", "rndc.key"
end
def post_install
(var/"log/named").mkpath
(var/"named").mkpath
end
def named_conf
<<~EOS
logging {
category default {
_default_log;
};
channel _default_log {
file "#{var}/log/named/named.log" versions 10 size 1m;
severity info;
print-time yes;
};
};
options {
directory "#{var}/named";
};
EOS
end
plist_options startup: true
service do
run [opt_sbin/"named", "-f", "-L", var/"log/named/named.log"]
end
test do
system bin/"dig", "-v"
system bin/"dig", "brew.sh"
system bin/"dig", "ü.cl"
end
end