1 class CloudflareQuiche < Formula
2 desc "Savoury implementation of the QUIC transport protocol and HTTP/3"
3 homepage "https://docs.quic.tech/quiche/"
4 url "https://github.com/cloudflare/quiche.git",
6 revision: "c5fc0679ece63636a2264ef273c75f08a405fdf7"
8 head "https://github.com/cloudflare/quiche.git", branch: "master"
11 sha256 cellar: :any, arm64_sequoia: "ce4557b96999526df17af6542bbe364a39b543e2439864be53014137397c69d1"
12 sha256 cellar: :any, arm64_sonoma: "220432f61056cebfe7c8ec17fb517952453129fbd1e901712ccf9778c5f8c067"
13 sha256 cellar: :any, arm64_ventura: "41886440961660f8a8e8a1b0b04499d528ff19a4b0b48c312c036ec71b886bb5"
14 sha256 cellar: :any, sonoma: "6fa5c717c65318ebfe51c8064073f8efe9fadc0f117e44d81300e64898b7cd93"
15 sha256 cellar: :any, ventura: "9c2ca9c5075176e4e66c50645631da77978662e3970f7d9624fee5dd01260861"
16 sha256 cellar: :any_skip_relocation, x86_64_linux: "4adbca974ad4e8a296889e0aed4f1e6c70d73a2be662f79773176a5fea29c4f7"
19 depends_on "cmake" => :build
20 depends_on "rust" => :build
23 system "cargo", "install", *std_cargo_args(path: "apps")
25 system "cargo", "build", "-j", "1", "--lib", "--features", "ffi,pkg-config-meta", "--release"
26 lib.install "target/release/libquiche.a"
27 include.install "quiche/include/quiche.h"
29 # install dylib with version and symlink
30 lib.install "target/release/#{shared_library("libquiche")}"
32 mv "#{lib}/libquiche.dylib", "#{lib}/libquiche.#{version.major_minor_patch}.dylib"
33 lib.install_symlink "#{lib}/libquiche.#{version.major_minor_patch}.dylib" => "#{lib}/libquiche.dylib"
35 mv "#{lib}/libquiche.so", "#{lib}/libquiche.so.#{version.major_minor_patch}"
36 lib.install_symlink "#{lib}/libquiche.so.#{version.major_minor_patch}" => "#{lib}/libquiche.so.#{version.major}"
37 lib.install_symlink "#{lib}/libquiche.so.#{version.major_minor_patch}" => "#{lib}/libquiche.so"
40 # install pkgconfig file
41 pc_path = "target/release/quiche.pc"
42 # the pc file points to the tmp dir, so we need inreplace
43 inreplace pc_path do |s|
44 s.gsub!(/includedir=.+/, "includedir=#{include}")
45 s.gsub!(/libdir=.+/, "libdir=#{lib}")
47 (lib/"pkgconfig").install pc_path
51 assert_match "it does support HTTP/3!", shell_output("#{bin}/quiche-client https://http3.is/")
52 (testpath/"test.c").write <<~C
55 quiche_config *config = quiche_config_new(0xbabababa);
59 system ENV.cc, "test.c", "-L#{lib}", "-lquiche", "-o", "test"