69 lines
2 KiB
Ruby
69 lines
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.8.tar.gz"
|
|
sha256 "9ee494e91bc33938575b2c09b26188c486ef8eac6e2155d250c189cc4e988c4f"
|
|
|
|
bottle do
|
|
sha256 "aabfb8c26c40e7ee1f2b23995dbf97cd0ee62112f9d027f627f4f6dde2cc4295" => :sierra
|
|
sha256 "ee9c6bbed49faa610ec015adbcb82c88032fdce218162bfde615589533724b7e" => :el_capitan
|
|
sha256 "583017bc3ecbc6abc45d65cc854faff386cc7f839a18c600304497c9ae11505a" => :yosemite
|
|
end
|
|
|
|
option "with-snmp", "Build SNMP subagent support"
|
|
|
|
depends_on "pkg-config" => :build
|
|
depends_on "readline"
|
|
depends_on "libevent"
|
|
depends_on "net-snmp" if build.with? "snmp"
|
|
|
|
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")
|
|
|
|
system "./configure", *args
|
|
system "make"
|
|
system "make", "install"
|
|
end
|
|
|
|
def post_install
|
|
(var/"run").mkpath
|
|
end
|
|
|
|
plist_options :startup => true
|
|
|
|
def plist
|
|
additional_args = ""
|
|
additional_args += "<string>-x</string>" if build.with? "snmp"
|
|
<<-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
|