class Nghttp2 < Formula desc "HTTP/2 C Library" homepage "https://nghttp2.org/" url "https://github.com/nghttp2/nghttp2/releases/download/v1.35.1/nghttp2-1.35.1.tar.xz" sha256 "9b7f5b09c3ca40a46118240bf476a5babf4bd93a1e4fde2337c308c4c5c3263a" bottle do sha256 "3df6011e98f13af091fcc9e4c759d9e9662ee4d9a863d88284e17b461c94be92" => :mojave sha256 "9c21365ecf3717afe8fda8307c8b80902d7b1f24275e45b8c8458ecc5e42560c" => :high_sierra sha256 "cb7ca00e18e43bab469ae685713bf43bd56067cd8395ad0c5921a4c9343726b9" => :sierra end head do url "https://github.com/nghttp2/nghttp2.git" depends_on "autoconf" => :build depends_on "automake" => :build depends_on "libtool" => :build end option "with-python", "Build python3 bindings" deprecated_option "with-python3" => "with-python" depends_on "cunit" => :build depends_on "pkg-config" => :build depends_on "sphinx-doc" => :build depends_on "c-ares" depends_on "jansson" depends_on "jemalloc" depends_on "libev" depends_on "libevent" depends_on "libxml2" if MacOS.version <= :lion depends_on "openssl" depends_on "python" => :optional resource "Cython" do url "https://files.pythonhosted.org/packages/f0/f8/7f406aac4c6919d5a4ce16509bbe059cd256e9ad94bae5ccac14094b7c51/Cython-0.29.1.tar.gz" sha256 "18ab7646985a97e02cee72e1ddba2e732d4931d4e1732494ff30c5aa084bfb97" 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 --disable-python-bindings ] # requires thread-local storage features only available in 10.11+ args << "--disable-threads" if MacOS.version < :el_capitan args << "--with-xml-prefix=/usr" if MacOS.version > :lion system "autoreconf", "-ivf" if build.head? system "./configure", *args system "make" system "make", "check" system "make", "install" 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