class Nghttp2 < Formula desc "HTTP/2 C Library" homepage "https://nghttp2.org/" url "https://github.com/nghttp2/nghttp2/releases/download/v1.68.0/nghttp2-1.68.0.tar.gz" mirror "http://fresh-center.net/linux/www/nghttp2-1.68.0.tar.gz" sha256 "2c16ffc588ad3f9e2613c3fad72db48ecb5ce15bc362fcc85b342e48daf51013" license "MIT" revision 1 bottle do sha256 cellar: :any, arm64_tahoe: "edc3918d4f7eaae2e0139b23d0726cf2366bd40b9ca42b588c5db31f6d5862bd" sha256 cellar: :any, arm64_sequoia: "65693fd8c12755bd248de72d054bdb2fa40c08b07504063ccff35a0b7c96cdab" sha256 cellar: :any, arm64_sonoma: "c14f803178054a097d5ad7e77cf456d85657454059fab94140053ea6917a00a7" sha256 cellar: :any, sonoma: "91481ad34cfda34a8c04c246b6f295c656d3b0d2eb36c7040e50f27ef3755373" sha256 cellar: :any_skip_relocation, arm64_linux: "b970fea49cc1fe0648d53440996bec54d5f49d6533b61a18b1f6842f509094ce" sha256 cellar: :any_skip_relocation, x86_64_linux: "aae534df297851aa9ab15c0a9fe088435d1cff39d1290acab7649ff778629fea" end head do url "https://github.com/nghttp2/nghttp2.git", branch: "master" depends_on "autoconf" => :build depends_on "automake" => :build depends_on "libtool" => :build end depends_on "pkgconf" => :build depends_on "c-ares" depends_on "jemalloc" depends_on "libev" depends_on "libnghttp2" depends_on macos: :sonoma # Needs C++20 features not available on Ventura depends_on "openssl@3" uses_from_macos "libxml2" uses_from_macos "zlib" on_macos do depends_on "llvm" => :build if DevelopmentTools.clang_build_version <= 1500 end fails_with :clang do build 1500 cause "Requires C++20 support" end fails_with :gcc do version "11" cause "Requires C++20 support" end def install # fix for clang not following C++14 behaviour # https://github.com/macports/macports-ports/commit/54d83cca9fc0f2ed6d3f873282b6dd3198635891 inreplace "src/shrpx_client_handler.cc", "return dconn;", "return std::move(dconn);" # Don't build nghttp2 library - use the previously built one. inreplace "Makefile.in", /(SUBDIRS =) lib/, "\\1" inreplace Dir["**/Makefile.in"] do |s| # These don't exist in all files, hence audit_result being false. s.gsub!(%r{^(LDADD = )\$[({]top_builddir[)}]/lib/libnghttp2\.la}, "\\1-lnghttp2", audit_result: false) s.gsub!(%r{\$[({]top_builddir[)}]/lib/libnghttp2\.la}, "", audit_result: false) end args = %w[ --disable-silent-rules --enable-app --disable-examples --disable-hpack-tools --disable-python-bindings --without-systemd ] system "autoreconf", "--force", "--install", "--verbose" if build.head? system "./configure", *args, *std_configure_args system "make" system "make", "install" end test do system bin/"nghttp", "-nv", "https://nghttp2.org" refute_path_exists lib end end