diff options
| author | Dominyk Tiller | 2015-01-13 04:24:36 +0000 |
|---|---|---|
| committer | Mike McQuaid | 2015-01-13 13:53:54 +0000 |
| commit | 1b687cb6186fc9235edde87d47973371d01dc527 (patch) | |
| tree | 937ace1b06f726d105f0b5283f7a7c95b5770c9f /Library | |
| parent | 13d0f2a5ae1e870744f934135c36300a88089edb (diff) | |
| download | homebrew-1b687cb6186fc9235edde87d47973371d01dc527.tar.bz2 | |
h2o 0.9.0 (new formula)
New formula for the ridiculously fast H2O HTTP Server.
Closes #35799.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Formula/h2o.rb | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/Library/Formula/h2o.rb b/Library/Formula/h2o.rb new file mode 100644 index 000000000..3491a0955 --- /dev/null +++ b/Library/Formula/h2o.rb @@ -0,0 +1,75 @@ +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" + + 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 + <?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>RunAtLoad</key> + <true/> + <key>KeepAlive</key> + <true/> + <key>ProgramArguments</key> + <array> + <string>#{opt_bin}/h2o</string> + <string>-c</string> + <string>#{etc}/h2o/h2o.conf</string> + </array> + </dict> + </plist> + EOS + end + + test do + system bin/"h2o", "--version" + end +end |
