homebrew-core/Formula/ejabberd.rb

84 lines
2.2 KiB
Ruby

require "formula"
class Ejabberd < Formula
homepage "http://www.ejabberd.im"
url "https://www.process-one.net/downloads/ejabberd/14.05/ejabberd-14.05.tgz"
sha1 "bad6b91ca6b9ac30ffe8b2eb0c5bb759d7742fab"
head 'https://github.com/processone/ejabberd.git'
bottle do
sha1 "deabd8e0139e5d1d7468a638f81324ad5d9e7800" => :mavericks
sha1 "02cf33e5c0d20403fd78c05d71a647041801e48c" => :mountain_lion
sha1 "f8cf33f1dea0a9b8edd9bc8015a0dbf4212dd5ae" => :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
<?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