homebrew-core/Formula/ejabberd.rb
2016-08-06 08:08:08 -07:00

96 lines
2.5 KiB
Ruby

class Ejabberd < Formula
desc "XMPP application server"
homepage "https://www.ejabberd.im"
url "https://www.process-one.net/downloads/ejabberd/16.08/ejabberd-16.08.tgz"
sha256 "b45598a6f2f1b398a19f23e3280b45eccc833d3339b1aeb6ec08ded7c19b1137"
bottle do
sha256 "4777eaed733a8b3f18b35bbde17de86c9e2d7e52e35cd36a001c3aaf66501f7c" => :el_capitan
sha256 "51d710e380a5db954eec6337c3232fd5ef814ede0f969ffb695a4ebc50b637db" => :yosemite
sha256 "e9dc90bbc28eb04b62e7393f5c7e8991cb8b0c7b2af23cf9be759182252feb30" => :mavericks
end
head do
url "https://github.com/processone/ejabberd.git"
depends_on "automake" => :build
depends_on "autoconf" => :build
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 "./autogen.sh" if build.head?
system "./configure", *args
system "make"
system "make", "install"
(etc/"ejabberd").mkpath
end
def post_install
(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>EnvironmentVariables</key>
<dict>
<key>HOME</key>
<string>#{var}/lib/ejabberd</string>
</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/>
<key>WorkingDirectory</key>
<string>#{var}/lib/ejabberd</string>
</dict>
</plist>
EOS
end
test do
system sbin/"ejabberdctl", "ping"
end
end