class Mosquitto < Formula desc "Message broker implementing the MQTT protocol" homepage "https://mosquitto.org/" url "https://mosquitto.org/files/source/mosquitto-1.5.6.tar.gz" sha256 "d5bdc13cc668350026376d57fc14de10aaee029f6840707677637d15e0751a40" bottle do sha256 "81c160e9083e6fb4058ade96c1144806a990da879fe1abbc6c2d1201c10d801d" => :mojave sha256 "cb010b507551762b9f54049a4b5ba335c2efb8d9d58499ee9c39973b23f5ad7d" => :high_sierra sha256 "9ad6d2605fb0e87d17f7b460774e5831902267d63e42754c0af02206fad4ba50" => :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 Label #{plist_name} ProgramArguments #{opt_sbin}/mosquitto -c #{etc}/mosquitto/mosquitto.conf RunAtLoad KeepAlive WorkingDirectory #{var}/mosquitto EOS end test do quiet_system "#{sbin}/mosquitto", "-h" assert_equal 3, $CHILD_STATUS.exitstatus end end