homebrew-core/Formula/ejabberd.rb
2018-10-27 09:45:08 +02: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/18.09/ejabberd-18.09.tgz"
sha256 "781a68d2deefb4afae563c29a8955063c759c244d308251167d46185f145d4ff"
bottle do
sha256 "a9655946c1b7eaa199339475c84aeec9be1c99b9d541f1b537f1c49bf1f7331c" => :mojave
sha256 "226a2827e29c3ad146762d94587c08d0442183e47c68f0eaf3f1aac814700ff4" => :high_sierra
sha256 "ed2429d0c5941fbfb7f7f34b3bdf09a73273441b44959a6c81fb2484ef5c56eb" => :sierra
end
head do
url "https://github.com/processone/ejabberd.git"
depends_on "autoconf" => :build
depends_on "automake" => :build
end
depends_on "erlang"
depends_on "gd"
depends_on "libyaml"
depends_on "openssl"
# 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
args = ["--prefix=#{prefix}",
"--sysconfdir=#{etc}",
"--localstatedir=#{var}",
"--enable-pgsql",
"--enable-mysql",
"--enable-odbc",
"--enable-pam"]
system "./autogen.sh" if build.head?
system "./configure", *args
# Set CPP to work around cpp shim issue:
# https://github.com/Homebrew/brew/issues/5153
system "make", "CPP=clang -E"
ENV.deparallelize
system "make", "install"
(etc/"ejabberd").mkpath
end
def post_install
(var/"lib/ejabberd").mkpath
(var/"spool/ejabberd").mkpath
end
def caveats; <<~EOS
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
<?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