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.4.tar.gz" sha256 "eb1f5beff2ff5c13c5e0342b5b9da815ed4a63866262445e1168a79ee65c9079" revision 2 bottle do sha256 "68513191e42cb6c5b8c0b17eb07d553d1d5b9f949dc82ba3e3c94ab02907820b" => :sierra sha256 "91db17ee1b90ebfe754dce063443d6ce1e0315b3b6b202685773983be3250f07" => :el_capitan sha256 "b2810c86f3cafe0d9771bb56fcc93b05189f2842e77c82ff159266ca33ba1b05" => :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