homebrew-core/Formula/mosquitto.rb

80 lines
2.2 KiB
Ruby

class Mosquitto < Formula
desc "Message broker implementing the MQTT protocol"
homepage "https://mosquitto.org/"
url "https://mosquitto.org/files/source/mosquitto-1.6.12.tar.gz"
sha256 "548d73d19fb787dd0530334e398fd256ef3a581181678488a741a995c4f007fb"
# dual-licensed under EPL-1.0 and EDL-1.0 (Eclipse Distribution License v1.0),
# EDL-1.0 is not in the SPDX list
license "EPL-1.0"
livecheck do
url "https://mosquitto.org/files/source/"
regex(/href=.*?mosquitto[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
cellar :any
sha256 "385bec6fa5729c75da5f86e33be78f38d675fa9fd5a95b5065305fda0253cef0" => :catalina
sha256 "e2c98b06302c46381e05f7b16bb52cfff9f04555ca4b9f5987764e0429018874" => :mojave
sha256 "32fbadbfcbc5a741c650559e056d1d61e0cdc869abc76674e7df5b1f08879e5f" => :high_sierra
end
depends_on "cmake" => :build
depends_on "pkg-config" => :build
depends_on "libwebsockets"
depends_on "openssl@1.1"
on_linux do
depends_on "util-linux"
end
def install
system "cmake", ".", *std_cmake_args, "-DWITH_WEBSOCKETS=ON"
system "make", "install"
end
def post_install
(var/"mosquitto").mkpath
end
def caveats
<<~EOS
mosquitto has been installed with a default configuration file.
You can make changes to the configuration by editing:
#{etc}/mosquitto/mosquitto.conf
EOS
end
plist_options manual: "mosquitto -c #{HOMEBREW_PREFIX}/etc/mosquitto/mosquitto.conf"
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>Label</key>
<string>#{plist_name}</string>
<key>ProgramArguments</key>
<array>
<string>#{opt_sbin}/mosquitto</string>
<string>-c</string>
<string>#{etc}/mosquitto/mosquitto.conf</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<false/>
<key>WorkingDirectory</key>
<string>#{var}/mosquitto</string>
</dict>
</plist>
EOS
end
test do
quiet_system "#{sbin}/mosquitto", "-h"
assert_equal 3, $CHILD_STATUS.exitstatus
end
end