homebrew-core/Formula/lldpd.rb
Mike McQuaid 7a4dabfc1a Use hash rockets again. (#5177)
This restores 1.8 hash rockets because they look nicer with e.g. `depends_on :foo => :bar`
2016-09-24 16:45:48 +01:00

74 lines
2.2 KiB
Ruby

class Lldpd < Formula
desc "Implementation of IEEE 802.1ab (LLDP)"
homepage "https://vincentbernat.github.io/lldpd/"
url "https://media.luffy.cx/files/lldpd/lldpd-0.9.4.tar.gz"
sha256 "eb1f5beff2ff5c13c5e0342b5b9da815ed4a63866262445e1168a79ee65c9079"
bottle do
sha256 "3569da143c5720d1c6a972824abda463728c60bd6bdad85193b4c2ad62c017dd" => :el_capitan
sha256 "2c5ca40cba844510bf49068f6bbe5641546f6ab2e395be429bea1ffd2672e259" => :yosemite
sha256 "f889e3be7ab8dfe9941d785c2555d15b3dd9ec312430f473274c15ffec28404b" => :mavericks
end
option "with-snmp", "Build SNMP subagent support"
option "with-json", "Build JSON support for lldpcli"
depends_on "pkg-config" => :build
depends_on "readline"
depends_on "libevent"
depends_on "net-snmp" if build.with? "snmp"
depends_on "jansson" if build.with? "json"
def install
readline = Formula["readline"]
args = [
"--prefix=#{prefix}",
"--sysconfdir=#{etc}",
"--localstatedir=#{var}",
"--with-xml",
"--with-readline",
"--with-privsep-chroot=/var/empty",
"--with-privsep-user=nobody",
"--with-privsep-group=nogroup",
"--with-launchddaemonsdir=no",
"CPPFLAGS=-I#{readline.include} -DRONLY=1",
"LDFLAGS=-L#{readline.lib}",
]
args << (build.with?("snmp") ? "--with-snmp" : "--without-snmp")
args << (build.with?("json") ? "--with-json" : "--without-json")
system "./configure", *args
system "make"
system "make", "install"
end
def post_install
(var/"run").mkpath
end
plist_options :startup => true
def plist
additional_args = ""
if build.with? "snmp"
additional_args += "<string>-x</string>"
end
<<-EOS.undent
<?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>ProgramArguments</key>
<array>
<string>#{opt_sbin}/lldpd</string>
#{additional_args}
</array>
<key>RunAtLoad</key><true/>
<key>KeepAlive</key><true/>
</dict>
</plist>
EOS
end
end