homebrew-core/Formula/ejabberd.rb

102 lines
2.6 KiB
Ruby

class Ejabberd < Formula
desc "XMPP application server"
homepage "https://www.ejabberd.im"
url "https://static.process-one.net/ejabberd/downloads/20.04/ejabberd-20.04.tgz"
sha256 "130673a835a9768a47c78c6bfe9c622a3b5916dd8aaf12aad0acd2d0f7f3a5cf"
license "GPL-2.0"
revision 1
bottle do
cellar :any
sha256 "7e50060f5ad3a6d7c55db410eb3762b2a95c5bd2fd296f31729b1393ceb5edcd" => :catalina
sha256 "6bc2b55c5d2c46703937ade4be7b8c6cce8bd32bd5f7119f084a7497f647434d" => :mojave
sha256 "31250e200d52ba9b03bcc4d699e74b868eb357391b4ac4864f765a87c9e77868" => :high_sierra
end
head do
url "https://github.com/processone/ejabberd.git"
depends_on "autoconf" => :build
depends_on "automake" => :build
end
depends_on "erlang@22"
depends_on "gd"
depends_on "libyaml"
depends_on "openssl@1.1"
conflicts_with "couchdb", because: "both install `jiffy` lib"
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