homebrew-core/Formula/ejabberd.rb
2016-09-28 16:05:17 -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.09/ejabberd-16.09.tgz"
sha256 "7b44ab3af3310ca73624c47b65cf30a651d5a1398413e8af51c610d788fb8f14"
bottle do
sha256 "99fa482b8b0a05e93f31570cd495e8f9223c709e791df7e7f7b1fa5b0bf84faf" => :sierra
sha256 "3001214ca51ed9bb0f5b635b814f2bd664c6e7cd86d607d21e23e314f936f40e" => :el_capitan
sha256 "e2db4f46d85783f1d39d4acfca9bb6667dde47f463941e5efbda169a2487999b" => :yosemite
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