homebrew-core/Formula/ejabberd.rb
2014-12-19 07:42:36 -05:00

80 lines
2.1 KiB
Ruby

require "formula"
class Ejabberd < Formula
homepage "http://www.ejabberd.im"
url "https://www.process-one.net/downloads/ejabberd/14.12/ejabberd-14.12.tgz"
sha1 "baf944fb15a31ea19a3bc6da685bbc0e7c0daeff"
head 'https://github.com/processone/ejabberd.git'
bottle do
sha1 "cdaca13e8fd41e5defc1290ab74d05a705886394" => :yosemite
sha1 "d92a0d0d6597da5417535fa68b10a6d5a5e6a129" => :mavericks
sha1 "dd4c7c56445788d9cd93151609c4a027409d2c58" => :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
# Homebrew's 'C compiler cannot create executables' bug workaround
ENV["HOMEBREW_ARCHFLAGS"] = " "
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
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>#{plist_name}</string>
<key>ProgramArguments</key>
<array>
<string>#{opt_sbin}/ejabberdctl</string>
<string>start</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
EOS
end
end