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" bottle do sha256 "7785ee99e6ecdeea449194b75d9a3e0b53ee1e7cb63547ab09569483f12bc903" => :sierra sha256 "f8280108975c87e1500129e747f6bffbae0b2801d0361b298d2cd2da6b23966f" => :el_capitan sha256 "9ee968068aa301fad671fb753aeebd16402b246af42c1615a8fb0fde9c29194c" => :yosemite sha256 "03ed2ccbe913b4df166683c8285770a8ef6dbb7e1445f1ab09263f882e1e0ac1" => :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" 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 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, $?.exitstatus end end