class Ejabberd < Formula desc "XMPP application server" homepage "https://www.ejabberd.im" url "https://www.process-one.net/downloads/ejabberd/17.06/ejabberd-17.06.tgz" sha256 "eb2926b53a24d53250c12b5593693575bdbaf0d5dbc6ce16f89678a138be997d" bottle do sha256 "59d6935ce9f3f4d0182535d3da2db21e8660363d7d0d30e260d40d72365187b2" => :sierra sha256 "04c5825c53ba709f0dd0e846aa1e2ec66a552b6ccb6be68aac0456ade30140c6" => :el_capitan sha256 "479a9b98d1cfcca05300dbbfae37cf3636038332a38a75ee9032ad88d3e890ae" => :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" ENV.deparallelize 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