class Nghttp2 < Formula desc "HTTP/2 C Library" homepage "https://nghttp2.org/" url "https://github.com/nghttp2/nghttp2/releases/download/v1.31.1/nghttp2-1.31.1.tar.xz" sha256 "65b9c83ae95a7760a14410aeefa9d441c34453027bc938df7a2272520f32e103" bottle do sha256 "776d4bda15c834ce38880ba49e2c7351aa6c7be51c817d3cc65b93a47c1a8839" => :high_sierra sha256 "362ee9d8c0a93e48c903ec66337ce957cdf51ba8f08145faadd28820a377c3aa" => :sierra sha256 "086cb6979e10c7e27f19d053eb7a1910c2862fbe854a7143e612c8a90d810cf5" => :el_capitan end head do url "https://github.com/nghttp2/nghttp2.git" depends_on "automake" => :build depends_on "autoconf" => :build depends_on "libtool" => :build end option "with-examples", "Compile and install example programs" option "with-python", "Build python3 bindings" deprecated_option "with-python3" => "with-python" depends_on "python" => :optional depends_on "sphinx-doc" => :build depends_on "libxml2" if MacOS.version <= :lion depends_on "pkg-config" => :build depends_on "cunit" => :build depends_on "c-ares" depends_on "libev" depends_on "openssl" depends_on "libevent" depends_on "jansson" depends_on "boost" depends_on "jemalloc" => :recommended resource "Cython" do url "https://files.pythonhosted.org/packages/be/08/bb5ffd1c32a951cbc26011ecb8557e59dc7a0a4975f0ad98b2cd7446f7dd/Cython-0.28.1.tar.gz" sha256 "152ee5f345012ca3bb7cc71da2d3736ee20f52cd8476e4d49e5e25c5a4102b12" end # https://github.com/tatsuhiro-t/nghttp2/issues/125 # Upstream requested the issue closed and for users to use gcc instead. # Given this will actually build with Clang with cxx11, just use that. needs :cxx11 def install ENV.cxx11 args = %W[ --prefix=#{prefix} --disable-silent-rules --enable-app --with-boost=#{Formula["boost"].opt_prefix} --enable-asio-lib --disable-python-bindings ] args << "--enable-examples" if build.with? "examples" args << "--with-xml-prefix=/usr" if MacOS.version > :lion args << "--without-jemalloc" if build.without? "jemalloc" system "autoreconf", "-ivf" if build.head? system "./configure", *args system "make" system "make", "check" # Currently this is not installed by the make install stage. if build.with? "docs" system "make", "html" doc.install Dir["doc/manual/html/*"] end system "make", "install" libexec.install "examples" if build.with? "examples" if build.with? "python" pyver = Language::Python.major_minor_version "python3" ENV["PYTHONPATH"] = cythonpath = buildpath/"cython/lib/python#{pyver}/site-packages" cythonpath.mkpath ENV.prepend_create_path "PYTHONPATH", lib/"python#{pyver}/site-packages" resource("Cython").stage do system "python3", *Language::Python.setup_install_args(buildpath/"cython") end cd "python" do system buildpath/"cython/bin/cython", "nghttp2.pyx" system "python3", *Language::Python.setup_install_args(prefix) end end end test do system bin/"nghttp", "-nv", "https://nghttp2.org" end end