class Ejabberd < Formula desc "XMPP application server" homepage "https://www.ejabberd.im" url "https://www.process-one.net/downloads/ejabberd/16.12/ejabberd-16.12.tgz" sha256 "133dd20b5444110d230bc6b27f850da8f5dc8a3b272b9f0731cff5977f72d303" bottle do sha256 "be308b4e6ddac8d249bc121623a59de40c6b9f6e33ce1e8468535e480b65dc85" => :sierra sha256 "d1898a81156e92a733f1b6a7fbd9b65dc41cebe5ff088ef2e3528483554dc709" => :el_capitan sha256 "4ca634a161e49e2de6d8f7cab2ffb3b89531306638ed70cf4b2de82dda68b3d3" => :yosemite end head do url "https://github.com/processone/ejabberd.git" depends_on "automake" => :build depends_on "autoconf" => :build end depends_on "openssl" depends_on "erlang" depends_on "libyaml" # for CAPTCHA challenges depends_on "imagemagick" => :optional def install ENV["TARGET_DIR"] = ENV["DESTDIR"] = "#{lib}/ejabberd/erlang/lib/ejabberd-#{version}" ENV["MAN_DIR"] = man ENV["SBIN_DIR"] = sbin args = ["--prefix=#{prefix}", "--sysconfdir=#{etc}", "--localstatedir=#{var}", "--enable-pgsql", "--enable-mysql", "--enable-odbc", "--enable-pam"] system "./autogen.sh" if build.head? system "./configure", *args system "make" system "make", "install" (etc/"ejabberd").mkpath end def post_install (var/"lib/ejabberd").mkpath (var/"spool/ejabberd").mkpath end def caveats; <<-EOS.undent If you face nodedown problems, concat your machine name to: /private/etc/hosts after 'localhost'. EOS end plist_options :manual => "#{HOMEBREW_PREFIX}/sbin/ejabberdctl start" def plist; <<-EOS.undent EnvironmentVariables HOME #{var}/lib/ejabberd Label #{plist_name} ProgramArguments #{opt_sbin}/ejabberdctl start RunAtLoad WorkingDirectory #{var}/lib/ejabberd EOS end test do system sbin/"ejabberdctl", "ping" end end