homebrew-core/Formula/nut.rb
2015-11-01 23:53:39 +01:00

78 lines
2.9 KiB
Ruby

class Nut < Formula
desc "Network UPS Tools: Support for various power devices"
homepage "http://www.networkupstools.org"
url "http://www.networkupstools.org/source/2.7/nut-2.7.3.tar.gz"
sha256 "ff44d95d06a51559a0a018eef7f8d17911c1002b6352a7d7580ff75acb12126b"
bottle do
revision 1
sha256 "b78afeef0043a9a22fe57d673c0c4f4ff14fcf77cfcdb7ea8d8b9b9092ba00d2" => :el_capitan
sha256 "8d2e76b8ee440afde4ea901484b73d60d587fa0f06000f5397b2686e526d09ed" => :yosemite
sha256 "d2f0ffcf035b9a7313732d3581f4ff57b9af2006e5f77286b403b2973024d9ed" => :mavericks
end
head do
url "https://github.com/networkupstools/nut.git"
depends_on "asciidoc" => :build
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
end
option "without-serial", "Omits serial drivers"
option "without-libusb-compat", "Omits USB drivers"
option "with-dev", "Includes dev headers"
option "with-net-snmp", "Builds SNMP support"
option "with-neon", "Builds XML-HTTP support"
option "with-powerman", "Builds powerman PDU support"
option "with-freeipmi", "Builds IPMI PSU support"
option "with-cgi", "Builds CGI wrappers"
option "with-libltdl", "Adds dynamic loading support of plugins using libltdl"
depends_on "pkg-config" => :build
depends_on "libusb-compat" => :recommended
depends_on "net-snmp" => :optional
depends_on "neon" => :optional
depends_on "powerman" => :optional
depends_on "freeipmi" => :optional
depends_on "openssl"
depends_on "libtool" => :build
depends_on "gd" if build.with? "cgi"
conflicts_with "rhino", :because => "both install `rhino` binaries"
def install
if build.head?
ENV["XML_CATALOG_FILES"] = "#{etc}/xml/catalog"
system "./autogen.sh"
end
args = ["--disable-dependency-tracking",
"--prefix=#{prefix}",
"--localstatedir=#{var}",
"--without-doc",
"--without-avahi",
"--with-macosx_ups",
"--with-openssl",
"--without-nss",
"--without-wrap"
]
args << (build.with?("serial") ? "--with-serial" : "--without-serial")
args << (build.with?("libusb-compat") ? "--with-usb" : "--without-usb")
args << (build.with?("dev") ? "--with-dev" : "--without-dev")
args << (build.with?("net-snmp") ? "--with-snmp" : "--without-snmp")
args << (build.with?("neon") ? "--with-neon" : "--without-neon")
args << (build.with?("powerman") ? "--with-powerman" : "--without-powerman")
args << (build.with?("ipmi") ? "--with-ipmi" : "--without-ipmi")
args << "--with-freeipmi" if build.with? "ipmi"
args << (build.with?("libltdl") ? "--with-libltdl" : "--without-libltdl")
args << (build.with?("cgi") ? "--with-cgi" : "--without-cgi")
system "./configure", *args
system "make", "install"
end
test do
system "#{bin}/dummy-ups", "-L"
end
end