class Ejabberd < Formula desc "XMPP application server" homepage "https://www.ejabberd.im" url "https://www.process-one.net/downloads/ejabberd/19.02/ejabberd-19.02.tgz" sha256 "fb72871a28fb0951e6b1553125c30ce6015a3527a61e9c22e522c24af841eaa1" bottle do cellar :any sha256 "49749d922507aefb319a633c91303c0b92548d6e728ffcdf5ee212878b9d5be7" => :mojave sha256 "04721a9380e6b9d02003e930d90a873632a5d1571efd4d79d97958155166f119" => :high_sierra sha256 "be68699ba5c08b3570082b72e94c144c23e415e04b5f4f76899ccfc245f1ae46" => :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" 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