class Ejabberd < Formula desc "XMPP application server" homepage "https://www.ejabberd.im" url "https://www.process-one.net/downloads/ejabberd/17.09/ejabberd-17.09.tgz" sha256 "6caf64cb472f8ab0f40429e967450555b7e1fec11d84fc5ea5d466381329cf03" bottle do sha256 "b7cfd636f150117138c8331a70025f9e3bad4136f84ccf2213ece4eb5595b3a8" => :high_sierra sha256 "f4397bc029f84b30aa0277bf6ffe0d1c318815a94e1da6408d8e2e49d47a40ca" => :sierra sha256 "10756dc3d75219d2464c7c31dffa5a23e3fd20cd5815a011261e2434a42f60b4" => :el_capitan 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 "gd" 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