homebrew-core/Formula/bind.rb

138 lines
4.2 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.16.16/bind-9.16.16.tar.xz"
sha256 "6c913902adf878e7dc5e229cea94faefc9d40f44775a30213edd08860f761d7b"
license "MPL-2.0"
version_scheme 1
head "https://gitlab.isc.org/isc-projects/bind9.git"
# 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_big_sur: "1760d6ca4c7828dba00ee1e08d8e5aa29c45e8b6989909e376a6c5addec1cb49"
sha256 big_sur: "d461b3f29beff84605e9de44c3f28bdc5c3623e532c8123c36120c8ea042cf5b"
sha256 catalina: "c92e452d281ea1e8007c398f705c403b186ea2d855250282dd0d7dc43586db35"
sha256 mojave: "574b9afb50b52e8530968ddb03958c156692138943491de472354605c4dd4142"
end
depends_on "pkg-config" => :build
depends_on "json-c"
depends_on "libidn2"
depends_on "libuv"
depends_on "openssl@1.1"
depends_on "python@3.9"
resource "ply" do
url "https://files.pythonhosted.org/packages/e5/69/882ee5c9d017149285cab114ebeab373308ef0f874fcdac9beb90e0ac4da/ply-3.11.tar.gz"
sha256 "00c7c1aaa88358b9c765b6d3000c6eec0ba42abca5351b095321aef446081da3"
end
def install
xy = Language::Python.major_minor_version Formula["python@3.9"].opt_bin/"python3"
vendor_site_packages = libexec/"vendor/lib/python#{xy}/site-packages"
ENV.prepend_create_path "PYTHONPATH", vendor_site_packages
resources.each do |r|
r.stage do
system Formula["python@3.9"].opt_bin/"python3", *Language::Python.setup_install_args(libexec/"vendor")
end
end
# 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}",
"--with-python-install-dir=#{vendor_site_packages}",
"--with-python=#{Formula["python@3.9"].opt_bin}/python3",
"--without-lmdb",
"--with-libidn2=#{Formula["libidn2"].opt_prefix}",
]
on_linux do
args << "--disable-linux-caps"
end
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
def plist
<<~EOS
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>EnableTransactions</key>
<true/>
<key>Label</key>
<string>#{plist_name}</string>
<key>RunAtLoad</key>
<true/>
<key>ProgramArguments</key>
<array>
<string>#{opt_sbin}/named</string>
<string>-f</string>
<string>-L</string>
<string>#{var}/log/named/named.log</string>
</array>
<key>ServiceIPC</key>
<false/>
</dict>
</plist>
EOS
end
test do
system bin/"dig", "-v"
system bin/"dig", "brew.sh"
system bin/"dig", "ü.cl"
end
end