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 += "-x" if build.with? "snmp"
<<~EOS
Label
#{plist_name}
ProgramArguments
#{opt_sbin}/lldpd
#{additional_args}
RunAtLoad
KeepAlive
EOS
end
end