homebrew-core/Formula/ejabberd.rb
Jack Nagel 53473b6bf5 Clean up MacOS version method usage
The MacOS.version? family of methods (other than "leopard?") are poorly
defined and lead to confusing code. Replace them in formulae with more
explicit comparisons.

"MacOS.version" is a special version object that can be compared to
numerics, symbols, and strings using the standard Ruby comparison
methods.

The old methods were moved to compat when the version comparison code
was merged, and they must remain there "forever", but they should not be
used in new code.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-09-10 16:16:54 -05:00

54 lines
1.4 KiB
Ruby

require 'formula'
class Ejabberd < Formula
homepage 'http://www.ejabberd.im'
url "http://www.process-one.net/downloads/ejabberd/2.1.11/ejabberd-2.1.11.tgz"
sha1 'ae2c521d5e93fbd5bc826052c5524b5222dcfae6'
depends_on "openssl" if MacOS.version == :leopard
depends_on "erlang"
option "32-bit"
option 'with-odbc', "Build with ODBC support"
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?
%w{ CFLAGS LDFLAGS }.each do |compiler_flag|
ENV.remove compiler_flag, "-arch x86_64"
ENV.append compiler_flag, "-arch i386"
end
end
cd "src" do
args = ["--prefix=#{prefix}",
"--sysconfdir=#{etc}",
"--localstatedir=#{var}"]
if MacOS.version == :leopard
openssl = Formula.factory('openssl')
args << "--with-openssl=#{openssl.prefix}"
end
args << "--enable-odbc" if build.include? 'with-odbc'
system "./configure", *args
system "make"
system "make install"
end
(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
end