homebrew-core/Formula/nghttp2.rb
2018-10-19 14:50:07 +02:00

99 lines
3.1 KiB
Ruby

class Nghttp2 < Formula
desc "HTTP/2 C Library"
homepage "https://nghttp2.org/"
stable do
url "https://github.com/nghttp2/nghttp2/releases/download/v1.34.0/nghttp2-1.34.0.tar.xz"
sha256 "ecb0c013141495e24bd6deca022b5a92097a7848a0c17c4e5af1243a97fa622e"
# apply upstream patch to fix compilation on macOS, remove in next release
patch do
url "https://github.com/nghttp2/nghttp2/commit/153531d4d0ebe00ac95047dbf1fec1d9d694f29f.patch?full_index=1"
sha256 "7b520ff66699dd41a84cbd287c06ed474ef21ce2b2fab34152267ac1d8ec07da"
end
end
bottle do
sha256 "a882c48e3d738c192cdd535ff785a96e9d77d87d894e53a75e2533742277fdba" => :mojave
sha256 "1668315be30654d2cce6a8e4f7036f7460ad72be418070106a0a9a706c347db2" => :high_sierra
sha256 "87b22ce014eb075dd0c0723b5921f1d6e8136270343dd90d36232010fd552725" => :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 "boost"
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/66/6309291b19b498b672817bd237caec787d1b18013ee659f17b1ec5844887/Cython-0.29.tar.gz"
sha256 "94916d1ede67682638d3cc0feb10648ff14dc51fb7a7f147f4fedce78eaaea97"
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
]
# 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