class H2o < Formula desc "HTTP server with support for HTTP/1.x and HTTP/2" homepage "https://github.com/h2o/h2o/" url "https://github.com/h2o/h2o/archive/v1.4.1.tar.gz" sha256 "b5695b08c90a22b5f164a632bae68b4e8c4ecf4f231a3d336c7f94562591e4e9" head "https://github.com/h2o/h2o.git" bottle do sha256 "89ed080ae9c1c2ecac37572e8eb9ce2de4133f022b30abfa9a9d24d1988a0f06" => :yosemite sha256 "37edd0ebba6c74f1aebe37cd6f67a8fe3b514d8578b92fa68b1f1fed96f8d91e" => :mavericks sha256 "709002e3527ed44e086898e3436a48128fcbaab5a48a1b464ea6581f1d12aaa1" => :mountain_lion end option "with-libuv", "Build the H2O library in addition to the executable" depends_on "cmake" => :build depends_on "pkg-config" => :build depends_on "openssl" => :recommended depends_on "libressl" => :optional depends_on "libuv" => :optional depends_on "wslay" => :optional depends_on "mruby" => :optional def install args = std_cmake_args args << "-DWITH_BUNDLED_SSL=OFF" args << "-DWITH_MRUBY=ON" if build.with? "mruby" system "cmake", *args if build.with? "libuv" system "make", "libh2o" lib.install "libh2o.a" end system "make", "install" (etc/"h2o").mkpath (var/"h2o").install "examples/doc_root/index.html" # Write up a basic example conf for testing. (buildpath/"brew/h2o.conf").write conf_example (etc/"h2o").install buildpath/"brew/h2o.conf" 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