homebrew-core/Formula/lldpd.rb
2019-01-13 12:22:56 +01:00

67 lines
1.8 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.1.tar.gz"
sha256 "450b622aac7ae1758f1ef82f3b7b94ec47f2ff33abfb0e6ac82555b9ee55f151"
revision 1
bottle do
sha256 "a5c99570bc5b5ec7e454348418e98e44e2e8a3d1749273c9874ec5089f75a33b" => :mojave
sha256 "07c52379bfa4f6aff982127f86c9350126bac9b1da7dadd41a718ac6f76404d9" => :high_sierra
sha256 "99a86ccaadefd3b90434cabc2f94a5ec1978e70db4d1f548e98566146db600ea" => :sierra
end
depends_on "pkg-config" => :build
depends_on "libevent"
depends_on "readline"
def install
readline = Formula["readline"]
args = %W[
--prefix=#{prefix}
--sysconfdir=#{etc}
--localstatedir=#{var}
--with-launchddaemonsdir=no
--with-privsep-chroot=/var/empty
--with-privsep-group=nogroup
--with-privsep-user=nobody
--with-readline
--with-xml
--without-snmp
CPPFLAGS=-I#{readline.include}\ -DRONLY=1
LDFLAGS=-L#{readline.lib}
]
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