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