class Ejabberd < Formula desc "XMPP application server" homepage "https://www.ejabberd.im" url "https://www.process-one.net/downloads/ejabberd/18.06/ejabberd-18.06.tgz" sha256 "ac9dbe8b58aec5403ecfe48cb90f11e7f55664185094bac94615c6c9323690b0" bottle do rebuild 1 sha256 "0098730930d77aaf10b75359db1517dee2d55abd92b229776a3b0757413728aa" => :mojave sha256 "5665a7f8986e4d2f032697fd84b9731cb171865fa48da6a360cbe68c2527fc46" => :high_sierra sha256 "d73f35ef3c7aa4761ad22b743d083ca8a19c8520fd40be9bda1803a6e60f0887" => :sierra end head do url "https://github.com/processone/ejabberd.git" depends_on "autoconf" => :build depends_on "automake" => :build end depends_on "erlang" depends_on "gd" depends_on "libyaml" depends_on "openssl" # 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 # Set CPP to work around cpp shim issue: # https://github.com/Homebrew/brew/issues/5153 system "make", "CPP=clang -E" ENV.deparallelize system "make", "install" (etc/"ejabberd").mkpath end def post_install (var/"lib/ejabberd").mkpath (var/"spool/ejabberd").mkpath end def caveats; <<~EOS 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 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