homebrew-core/Formula/pdns.rb

94 lines
2.6 KiB
Ruby

class Pdns < Formula
desc "Authoritative nameserver"
homepage "https://www.powerdns.com"
url "https://downloads.powerdns.com/releases/pdns-4.1.0.tar.bz2"
sha256 "db9193b0f0255c24dfbfc31ecff8bd39e21fec05ff7526e5aea963abc517f0f3"
revision 2
bottle do
sha256 "5c8d8f57d9d9b7e6fff5d91dfabdb777b90d2d18da9ca66ea2054b29da62e2c9" => :high_sierra
sha256 "8a81c1170b16f791b79beb1bc3e9c3e12381660edb111471f71b993d0eca4e49" => :sierra
sha256 "924ee78a1bc593786d7ee5735e43ab7be6854eeb663de76f15fde80c544845f3" => :el_capitan
end
head do
url "https://github.com/powerdns/pdns.git"
depends_on "automake" => :build
depends_on "autoconf" => :build
depends_on "libtool" => :build
depends_on "ragel"
end
option "with-postgresql", "Enable the PostgreSQL backend"
option "with-remote", "enable the Remote backend"
deprecated_option "pgsql" => "with-postgresql"
deprecated_option "with-pgsql" => "with-postgresql"
depends_on "pkg-config" => :build
depends_on "boost"
depends_on "lua"
depends_on "openssl"
depends_on "sqlite"
depends_on "postgresql" => :optional
def install
# Fix "configure: error: cannot find boost/program_options.hpp"
ENV["SDKROOT"] = MacOS.sdk_path if MacOS.version == :sierra
args = %W[
--prefix=#{prefix}
--sysconfdir=#{etc}/powerdns
--with-lua
--with-openssl=#{Formula["openssl"].opt_prefix}
--with-sqlite3
]
# Include the PostgreSQL backend if requested
if build.with? "postgresql"
args << "--with-modules=gsqlite3 gpgsql"
elsif build.with? "remote"
args << "--with-modules=gsqlite3 remote"
else
# SQLite3 backend only is the default
args << "--with-modules=gsqlite3"
end
system "./bootstrap" if build.head?
system "./configure", *args
system "make", "install"
end
plist_options :manual => "pdns_server start"
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>KeepAlive</key>
<true/>
<key>Label</key>
<string>#{plist_name}</string>
<key>ProgramArguments</key>
<array>
<string>#{opt_bin}/pdns_server</string>
</array>
<key>EnvironmentVariables</key>
<key>KeepAlive</key>
<true/>
<key>SHAuthorizationRight</key>
<string>system.preferences</string>
</dict>
</plist>
EOS
end
test do
output = shell_output("#{sbin}/pdns_server --version 2>&1", 99)
assert_match "PowerDNS Authoritative Server #{version}", output
end
end