homebrew-core/Formula/knot-resolver.rb
2019-04-20 13:47:50 +02:00

87 lines
2.6 KiB
Ruby

class KnotResolver < Formula
desc "Minimalistic, caching, DNSSEC-validating DNS resolver"
homepage "https://www.knot-resolver.cz"
url "https://secure.nic.cz/files/knot-resolver/knot-resolver-3.2.1.tar.xz"
sha256 "d1396888ec3a63f19dccdf2b7dbcb0d16a5d8642766824b47f4c21be90ce362b"
revision 1
head "https://gitlab.labs.nic.cz/knot/knot-resolver.git"
bottle do
sha256 "d10e18db53db4a96db665cb04a04d84d9050e8f2cd4989420bab6dbb13a1f6be" => :mojave
sha256 "c6d685f41c1ce47998c825c89c228013e4303fd14271c3a204a13b6ac9008bdc" => :high_sierra
sha256 "527254894d8ffb9c97a9e00dfbe19a6509c009d901e4e3be2410ee80636e0991" => :sierra
end
depends_on "cmocka" => :build
depends_on "pkg-config" => :build
depends_on "gnutls"
depends_on "knot"
depends_on "libuv"
depends_on "lmdb"
depends_on "luajit"
depends_on "nettle"
def install
# Since we don't run `make install` or `make etc-install`, we need to
# install root.hints manually before running `make check`.
cp "etc/root.hints", buildpath
(etc/"kresd").install "root.hints"
%w[all lib-install daemon-install client-install modules-install
check].each do |target|
system "make", target, "PREFIX=#{prefix}", "ETCDIR=#{etc}/kresd"
end
cp "etc/config.personal", "config"
inreplace "config", /^\s*user\(/, "-- user("
(etc/"kresd").install "config"
(etc/"kresd").install "etc/root.hints"
(etc/"kresd").install "etc/icann-ca.pem"
(buildpath/"root.keys").write(root_keys)
(var/"kresd").install "root.keys"
end
# DNSSEC root anchor published by IANA (https://www.iana.org/dnssec/files)
def root_keys; <<~EOS
. IN DS 20326 8 2 e06d44b80b8f1d39a95c0b0d7c65d08458e880409bbc683457104237c7f8ec8d
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>Label</key>
<string>#{plist_name}</string>
<key>WorkingDirectory</key>
<string>#{var}/kresd</string>
<key>RunAtLoad</key>
<true/>
<key>ProgramArguments</key>
<array>
<string>#{sbin}/kresd</string>
<string>-c</string>
<string>#{etc}/kresd/config</string>
<string>-f</string>
<string>1</string>
</array>
<key>StandardInPath</key>
<string>/dev/null</string>
<key>StandardOutPath</key>
<string>/dev/null</string>
<key>StandardErrorPath</key>
<string>#{var}/log/kresd.log</string>
</dict>
</plist>
EOS
end
test do
system sbin/"kresd", "--version"
end
end