2014-02-27 17:22:44 +00:00
|
|
|
require 'formula'
|
2013-01-13 12:24:44 +00:00
|
|
|
|
|
|
|
class Lldpd < Formula
|
|
|
|
homepage 'http://vincentbernat.github.io/lldpd/'
|
2014-12-12 03:45:46 +00:00
|
|
|
url 'http://media.luffy.cx/files/lldpd/lldpd-0.7.12.tar.gz'
|
|
|
|
sha1 '2d602aaaad01d1f76f8e1c87e48dca1c6725ba78'
|
2013-01-13 12:24:44 +00:00
|
|
|
|
2014-12-12 05:28:27 +00:00
|
|
|
bottle do
|
|
|
|
sha1 "c77debb346c325a44b8e91a7b983b251dc1db76f" => :yosemite
|
|
|
|
sha1 "52737f6933bc2d052ece4877d36c021fd6e648c1" => :mavericks
|
|
|
|
sha1 "6d6d4f6d4b7e23b9f707db180c99c24174ff9293" => :mountain_lion
|
|
|
|
end
|
|
|
|
|
2013-01-13 12:24:44 +00:00
|
|
|
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'
|
2014-03-06 20:40:26 +00:00
|
|
|
depends_on 'net-snmp' if build.with? "snmp"
|
|
|
|
depends_on 'jansson' if build.with? "json"
|
2013-01-13 12:24:44 +00:00
|
|
|
|
|
|
|
def install
|
2014-02-27 03:36:54 +00:00
|
|
|
readline = Formula["readline"]
|
|
|
|
args = ["--prefix=#{prefix}",
|
|
|
|
"--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}"]
|
2014-03-06 20:40:26 +00:00
|
|
|
args << "--with-snmp" if build.with? "snmp"
|
|
|
|
args << "--with-json" if build.with? "json"
|
2013-01-13 12:24:44 +00:00
|
|
|
|
|
|
|
system "./configure", *args
|
|
|
|
system "make"
|
|
|
|
system "make install"
|
|
|
|
end
|
|
|
|
|
|
|
|
plist_options :startup => true
|
|
|
|
|
|
|
|
def plist
|
|
|
|
additional_args = ""
|
2014-03-06 20:40:26 +00:00
|
|
|
if build.with? "snmp"
|
2013-01-13 12:24:44 +00:00
|
|
|
additional_args += "<string>-x</string>"
|
|
|
|
end
|
|
|
|
return <<-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>
|
2014-03-06 05:28:31 +00:00
|
|
|
<string>#{opt_sbin}/lldpd</string>
|
2013-01-13 12:24:44 +00:00
|
|
|
#{additional_args}
|
|
|
|
</array>
|
|
|
|
<key>RunAtLoad</key><true/>
|
|
|
|
<key>KeepAlive</key><true/>
|
|
|
|
</dict>
|
|
|
|
</plist>
|
|
|
|
EOS
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|