class H2o < Formula homepage "https://github.com/h2o/h2o/" url "https://github.com/h2o/h2o/archive/v0.9.0.tar.gz" sha1 "37b84750900cdb56c3be574477d6f3327d92a4d7" head "https://github.com/h2o/h2o.git" bottle do sha1 "44985fe8eb1e5c32754d7b3b3b4dfc1ccbdd181b" => :yosemite sha1 "05559a33588d48ad7b330f9f98b37ceae2af84dd" => :mavericks sha1 "90e3cdc944871b81620ab76b6e09311da99e516c" => :mountain_lion end option "with-libuv", "Build the H2O library as well as the executable." depends_on "cmake" => :build depends_on "libyaml" depends_on "openssl" depends_on "libuv" => :optional def install system "cmake", ".", *std_cmake_args if build.with? "libuv" system "make", "libh2o" lib.install "libh2o.a" end system "make", "install" mkdir_p etc/"h2o" mkdir_p var/"h2o" (var+"h2o").install "examples/doc_root/index.html" (etc+"h2o/h2o.conf").write conf_example end # This is simplified from examples/h2o/h2o.conf upstream. def conf_example; <<-EOS.undent listen: 8080 hosts: "127.0.0.1.xip.io:8080": paths: /: file.dir: #{var}/h2o/ EOS end def caveats; <<-EOS.undent A basic example configuration file has been placed in #{etc}/h2o. You can find fuller, unmodified examples here: https://github.com/h2o/h2o/tree/master/examples/h2o EOS end plist_options :manual => "h2o" def plist; <<-EOS.undent Label #{plist_name} RunAtLoad KeepAlive ProgramArguments #{opt_bin}/h2o -c #{etc}/h2o/h2o.conf EOS end test do system bin/"h2o", "--version" end end