110 lines
2.8 KiB
Ruby
110 lines
2.8 KiB
Ruby
class Ejabberd < Formula
|
|
desc "XMPP application server"
|
|
homepage "https://www.ejabberd.im"
|
|
url "https://static.process-one.net/ejabberd/downloads/20.07/ejabberd-20.07.tgz"
|
|
sha256 "9e922b938458ae9d72d4e5fdd2d08a1fbad651aae47c9a9d15b79d0bbd1e11f8"
|
|
license "GPL-2.0"
|
|
revision 1
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "e196794bf1e7a303e57dc8fe7d86a8c20ff3377c7898dee386e576aa97f32fbe" => :catalina
|
|
sha256 "162ee337822b273b41a2c8321a5f5fc9d40175d70dcd9b1d334c6b0b38139b2d" => :mojave
|
|
sha256 "49b8ba3a3c253fa2e0cf3a856d9895cceafad05b3ad54ff0d207056e78c8f9d3" => :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
|
|
|
|
# Create the vm.args file, to generate a cookie
|
|
require "securerandom"
|
|
cookie = SecureRandom.hex
|
|
vm_args_file = etc/"ejabberd/vm.args"
|
|
vm_args_file.write <<~EOS
|
|
-setcookie #{cookie}
|
|
EOS
|
|
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
|