homebrew-core/Formula/mosquitto.rb
2015-12-17 21:09:14 +00:00

68 lines
2 KiB
Ruby

class Mosquitto < Formula
desc "Message broker implementing MQ telemetry transport protocol"
homepage "https://mosquitto.org/"
url "https://mosquitto.org/files/source/mosquitto-1.4.5.tar.gz"
sha256 "b432e19fee0c549f4a0fb0e866d1b6a897b38dbf1ddfda92bb43e2a24f01df66"
bottle do
revision 1
sha256 "00390161ca1e2afc6dda57931c5f0adcc7c03bec8a706b3e6aab193c7e2ba0ee" => :el_capitan
sha256 "7aab82f99f359c047341e1c5e18ea00c81b4c58dff6de2754605dc2072a24a32" => :yosemite
sha256 "b2d6e9ba45f454b61d71929340e55c7851400264e42c94a77f82da34075af4d0" => :mavericks
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"
# Create the working directory
(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