69 lines
2 KiB
Ruby
69 lines
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.4.14.tar.gz"
|
|
sha256 "156b1fa731d12baad4b8b22f7b6a8af50ba881fc711b81e9919ec103cf2942d1"
|
|
revision 2
|
|
|
|
bottle do
|
|
sha256 "db6cc90bff7409aa2d287a9e090458fc5ffd2ef882c6d38efee28bfe9bc43bae" => :high_sierra
|
|
sha256 "88a6fd908f71fdf46ed19f0baa7154759751227c92234afe30ba27bf218db653" => :sierra
|
|
sha256 "d3195ebbcd82c77b56a0e65c1752ae803d5593d2a39b665e0524c853a0520878" => :el_capitan
|
|
end
|
|
|
|
depends_on "pkg-config" => :build
|
|
depends_on "cmake" => :build
|
|
depends_on "c-ares"
|
|
depends_on "openssl"
|
|
depends_on "libwebsockets" => :recommended
|
|
|
|
def install
|
|
args = std_cmake_args
|
|
args << "-DWITH_WEBSOCKETS=ON" if build.with? "libwebsockets"
|
|
|
|
system "cmake", ".", *args
|
|
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
|