homebrew-core/Formula/mosquitto.rb
2017-03-14 23:48:01 +01:00

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.11.tar.gz"
sha256 "ca47533bbc1b7c5e15d6e5d96d3efc59677f2515b6692263c34b7c48f33280c5"
revision 2
bottle do
sha256 "3067a892bccb9675c46ad449f020a5405f9bc6c68cd2abf2fb6399bb04362826" => :sierra
sha256 "f208d2a4e29149504bd9f20ea5cc43b856a498323179bef42f3d9bb8c5ccf0bc" => :el_capitan
sha256 "9386b2c2a797d66ad5604a0d17cbf47126ed5c4e0865a451bb81b8f7f68e7826" => :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