homebrew-core/Formula/mosquitto.rb
2019-08-17 12:20:06 +02:00

66 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.4.tar.gz"
sha256 "a3d5822c249f6a6e13311b1b09eff6807ea01608a5a77934e1769842e9d146ef"
revision 1
bottle do
cellar :any
sha256 "af872a69b14e4afb695e0a1b3b5cbab1c173745786f8ca50b96c97fa69a3bdf3" => :mojave
sha256 "b6aa2771c20eb913832555dac11f82ba2708cd6d635726c763a759e4db05db6d" => :high_sierra
sha256 "44f0b813a9e12316a893c933e5c86dc30433a89b580f781c89f4f0db35adfd4a" => :sierra
end
depends_on "cmake" => :build
depends_on "pkg-config" => :build
depends_on "libwebsockets"
depends_on "openssl"
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