homebrew-core/Formula/mosquitto.rb
2019-12-03 14:07:53 -05:00

65 lines
1.9 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.8.tar.gz"
sha256 "7df23c81ca37f0e070574fe74414403cf25183016433d07add6134366fb45df6"
bottle do
cellar :any
sha256 "8bcc87c919481aba7ce1515effa9fec154c6398edf2ffb4dec1d20a6a6add0f0" => :catalina
sha256 "623759637c867ff00bca4808bea2a6a895aaebcaed4b94cf8f6df461f9225015" => :mojave
sha256 "a372f6751069c731c84569f14d883363a8effed5326a90681ffe28a910abf9a0" => :high_sierra
end
depends_on "cmake" => :build
depends_on "pkg-config" => :build
depends_on "libwebsockets"
depends_on "openssl@1.1"
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