homebrew-core/Formula/mosquitto.rb

84 lines
2.4 KiB
Ruby

class Mosquitto < Formula
desc "Message broker implementing the MQTT protocol"
homepage "https://mosquitto.org/"
url "https://mosquitto.org/files/source/mosquitto-2.0.9.tar.gz"
sha256 "1b8553ef64a1cf5e4f4cfbe098330ae612adccd3d37f35b2db6f6fab501b01d4"
# 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/download/"
regex(/href=.*?mosquitto[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
sha256 arm64_big_sur: "e5abebed466350b9a8b04ec48e362d6c0d38ac65ffa797890331de6194a95698"
sha256 big_sur: "055cde20ee6ee13a27e58049d433fd7ec0630e2857677de69ba256b93c969ada"
sha256 catalina: "9ffde39e978b12523123b68ee121d75f4be27cd12b37f0bef601f3a838239c96"
sha256 mojave: "d1e4b6475a80c876bfcd76195f66af91b040455663b3e3293ee995d9582153f0"
end
depends_on "cmake" => :build
depends_on "pkg-config" => :build
depends_on "libwebsockets"
depends_on "openssl@1.1"
uses_from_macos "libxslt" => :build
on_linux do
depends_on "util-linux"
end
def install
system "cmake", ".", *std_cmake_args,
"-DWITH_WEBSOCKETS=ON",
"-DCMAKE_INSTALL_RPATH=#{lib}"
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