class Ejabberd < Formula desc "XMPP application server" homepage "https://www.ejabberd.im" url "https://www.process-one.net/downloads/ejabberd/15.06/ejabberd-15.06.tgz" sha256 "fcc001d0f2fc8b99bb2a4e7a42ec02c3c5d62191ea2aae19636f88e4e08be3a8" head "https://github.com/processone/ejabberd.git" bottle do sha256 "e33ffb53e8872eedb596cf957bff8a5a2da978030e8f16ed0a9356c9a0673734" => :yosemite sha256 "966402cea51d6537cf718cb0dc62fa3bde5f3aa93b25cad1df09335fe36282b2" => :mavericks sha256 "195288bb1ae8f59c29cd57386de6835bd6d67bab2fa7564d19d1c5eff543a5da" => :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