homebrew-core/Formula/mosquitto.rb

70 lines
2.0 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.10.tar.gz"
sha256 "437648d68a4a781dd8d913814cd5451f59ab4a5fcf84cccaf7c36e6a07459770"
revision 1
bottle do
sha256 "a046aab3261d705d49201f28c7475d232fac3911abfe74f798bb5ebfb2fb726c" => :sierra
sha256 "789d92c8c59f88597e1bc8360fd4baa73e21e517b84e5a6d54ea245ae9dcf480" => :el_capitan
sha256 "a216efeefe34baf53593bc9ae940a5898d6636586f7ba43f1eeaa8524ce4378d" => :yosemite
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.undent
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.undent
<?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, $?.exitstatus
end
end