homebrew-core/Formula/ejabberd.rb

84 lines
2.2 KiB
Ruby
Raw Normal View History

require "formula"
2011-03-10 05:11:03 +00:00
class Ejabberd < Formula
homepage "http://www.ejabberd.im"
url "https://www.process-one.net/downloads/ejabberd/14.07/ejabberd-14.07.tgz"
sha1 "321b28faedbc28f80664d4b301424b118dd0bad0"
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"] = " "
2012-08-28 04:33:50 +00:00
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