require "formula" class Ejabberd < Formula homepage "http://www.ejabberd.im" url "https://www.process-one.net/downloads/ejabberd/14.07/ejabberd-14.07.tgz" sha1 "321b28faedbc28f80664d4b301424b118dd0bad0" revision 1 head 'https://github.com/processone/ejabberd.git' bottle do sha1 "059ccab62554453458e922aee4ba753287ed2098" => :mavericks sha1 "b739b73fed4312709473a80a637cec8d8c8d37dc" => :mountain_lion sha1 "df284f6d0ce9d5eb86754b59e6ff2a598d847984" => :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 # Homebrew's 'C compiler cannot create executables' bug workaround ENV["HOMEBREW_ARCHFLAGS"] = " " if build.build_32_bit? %w{ CFLAGS LDFLAGS }.each do |compiler_flag| ENV.remove compiler_flag, "-arch #{Hardware::CPU.arch_64_bit}" ENV.append compiler_flag, "-arch #{Hardware::CPU.arch_32_bit}" end 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 Label #{plist_name} ProgramArguments #{opt_sbin}/ejabberdctl start RunAtLoad EOS end end