class Ejabberd < Formula desc "XMPP application server" homepage "https://www.ejabberd.im" url "https://www.process-one.net/downloads/ejabberd/15.04/ejabberd-15.04.tgz" sha256 "6750199b75d6b658dabffdf34e20994803b2fc0832e54fea7ab388e5122d63ec" head "https://github.com/processone/ejabberd.git" bottle do sha256 "b0591b932687ecfc54acedd1cc3b312b90654954a775a516fdd9f1194808cbdb" => :yosemite sha256 "22e2ac10889e5036583ee32914515d30f10c4a3a5b19c70cf3ae90079cd4783d" => :mavericks sha256 "b9fe7179d1cafb381b69ecc3dfcc329038a0aba61db0a53389552f42b6322b3d" => :mountain_lion end option "32-bit" 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 if build.build_32_bit? ENV.append %w[CFLAGS LDFLAGS], "-arch #{Hardware::CPU.arch_32_bit}" end args = ["--prefix=#{prefix}", "--sysconfdir=#{etc}", "--localstatedir=#{var}", "--enable-pgsql", "--enable-mysql", "--enable-odbc", "--enable-pam"] system "./configure", *args system "make" system "make", "install" (etc+"ejabberd").mkpath (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 end