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.6.tar.gz" sha256 "e74e2dd7e2a233ca1ff385c925ddae2a916d302819d1433741407d2f8fb0ddd8" bottle do sha256 "9e3600774e6e6417b3371792b24676cc9dbc890b10006b91b2f9e04875d45b42" => :sierra sha256 "03bf3d65b9d6adb9f22dd57eb936b7633e4e6b30ebc6c31ab8a3a4804fc9b771" => :el_capitan sha256 "d92c3e706366f0a5b841fdc462a099c9e423b3fb6b63ca9682181cc035ac490e" => :yosemite end 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" depends_on "net-snmp" if build.with? "snmp" depends_on "jansson" if build.with? "json" 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") args << (build.with?("json") ? "--with-json" : "--without-json") system "./configure", *args system "make" system "make", "install" end def post_install (var/"run").mkpath end plist_options :startup => true def plist additional_args = "" if build.with? "snmp" additional_args += "-x" end <<-EOS.undent Label #{plist_name} ProgramArguments #{opt_sbin}/lldpd #{additional_args} RunAtLoad KeepAlive EOS end end