class Lldpd < Formula desc "Implementation of IEEE 802.1ab (LLDP)" homepage "https://vincentbernat.github.io/lldpd/" url "http://media.luffy.cx/files/lldpd/lldpd-0.9.3.tar.gz" sha256 "cfa8a3245dd71efc1f5de064a72576a7c1afaaf0ccb5833238398b6dc612b127" bottle do sha256 "63c0a76719d7243976cbdd971ce4f65ebb9d1bad7909a8144a3f77d26fa08b0e" => :el_capitan sha256 "741ba34732c3ab89031eb42eb797bbe25709912db0877188011c495a4ff79cff" => :yosemite sha256 "2685403a92d8825c6ea70ccbfded8d7f019d38d24bf2d951565659aa46e15955" => :mavericks 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