class Bitlbee < Formula desc "IRC to other chat networks gateway" homepage "https://www.bitlbee.org/" head "https://github.com/bitlbee/bitlbee.git" stable do url "https://get.bitlbee.org/src/bitlbee-3.5.1.tar.gz" sha256 "9636d7fd89ebb3756c13a9a3387736ca6d56ccf66ec0580d512f07b21db0fa69" # Fixes a couple of bugs/potential crashes. patch do url "https://github.com/bitlbee/bitlbee/commit/17a58dfa.patch?full_index=1" sha256 "3a5729fd68bedabd1df717124e1950897eaee9feaf8237f6d67746e73df6cc6b" end patch do url "https://github.com/bitlbee/bitlbee/commit/eb73d05e.patch?full_index=1" sha256 "a54bdc82ff2959992e081586f5dd478a1719cd5037ebb0bfa54db6013853e0a5" end end bottle do sha256 "75272001af19553b23bd5d999c76570e9f53c5f0386fe8377f4e8af6e525fb50" => :high_sierra sha256 "a73fcc3ea892e02dff11eda82c9338230f16778d786dbcfecae89802fb0859cb" => :sierra sha256 "f1e4ace83358ed1164d5d8cfbe7ffe239b5698d24211150b86dbf4d4fb589a37" => :el_capitan sha256 "85eebf3ba9ee2e986ef1c54b99a8df958cf48a1d5112f765e5498d9be23b9426" => :yosemite end option "with-pidgin", "Use finch/libpurple for all communication with instant messaging networks" option "with-libotr", "Build with otr (off the record) support" option "with-libevent", "Use libevent for the event-loop handling rather than glib." deprecated_option "with-finch" => "with-pidgin" depends_on "pkg-config" => :build depends_on "gettext" depends_on "glib" depends_on "gnutls" depends_on "libgcrypt" depends_on "pidgin" => :optional depends_on "libotr" => :optional depends_on "libevent" => :optional def install args = %W[ --prefix=#{prefix} --plugindir=#{HOMEBREW_PREFIX}/lib/bitlbee/ --debug=0 --ssl=gnutls --etcdir=#{etc}/bitlbee --pidfile=#{var}/bitlbee/run/bitlbee.pid --config=#{var}/bitlbee/lib/ --ipsocket=#{var}/bitlbee/run/bitlbee.sock ] args << "--purple=1" if build.with? "pidgin" args << "--otr=1" if build.with? "libotr" args << "--events=libevent" if build.with? "libevent" system "./configure", *args # This build depends on make running first. system "make" system "make", "install" # Install the dev headers too system "make", "install-dev" # This build has an extra step. system "make", "install-etc" end def post_install (var/"bitlbee/run").mkpath (var/"bitlbee/lib").mkpath end plist_options :manual => "bitlbee -D" def plist; <<~EOS Label #{plist_name} OnDemand ProgramArguments #{opt_sbin}/bitlbee ServiceDescription bitlbee irc-im proxy Sockets Listener SockFamily IPv4 SockProtocol TCP SockNodeName 127.0.0.1 SockServiceName 6667 SockType stream inetdCompatibility Wait EOS end test do assert_match version.to_s, shell_output("#{sbin}/bitlbee -V", 1) end end