homebrew-core/Formula/lldpd.rb
2018-04-09 09:29:45 +02:00

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-1.0.0.tar.gz"
sha256 "13b09f43f530c6e9eec8ead0493e1b34f332b8ead89e46623e1fc40bb137b80d"
bottle do
sha256 "76809828122acdc997a3a1d0cb26cbbf1ff824c8749489651e489ea3e7d3de8e" => :high_sierra
sha256 "a4f1f3f4ae1feece3d3c002f2922f9246a9b725d7b21d6a020563958e07b0d61" => :sierra
sha256 "2b27b264d12e097e4ed486c9ea33171c3ef601550e2075b314cb4423721d41df" => :el_capitan
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
<?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