Skip to content

Commit

Permalink
cloudflare-quiche: install C lib
Browse files Browse the repository at this point in the history
Currently, the formula only installs the example binaries
from https://github.com/cloudflare/quiche. Formula now installs
the C lib through "cargo build" command for ffi. Test for
compilation/linking added.
  • Loading branch information
marshallstone authored and carlocab committed May 19, 2023
1 parent b4ce632 commit 227fa61
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Formula/cloudflare-quiche.rb
Expand Up @@ -22,9 +22,22 @@ class CloudflareQuiche < Formula

def install
system "cargo", "install", *std_cargo_args(path: "apps")

system "cargo", "build", "--offline", "--lib", "--features", "ffi", "--release"
lib.install "target/release/#{shared_library("libquiche")}"
include.install "quiche/include/quiche.h"
end

test do
assert_match "it does support HTTP/3!", shell_output("#{bin}/quiche-client https://http3.is/")
(testpath/"test.c").write <<~EOS
#include <quiche.h>
int main() {
quiche_config *config = quiche_config_new(0xbabababa);
return 0;
}
EOS
system ENV.cc, "test.c", "-L#{lib}", "-lquiche", "-o", "test"
system "./test"
end
end

0 comments on commit 227fa61

Please sign in to comment.