Skip to content

Commit

Permalink
libmsquic 2.4.4 (new formula)
Browse files Browse the repository at this point in the history
  • Loading branch information
liveans committed Sep 27, 2024
1 parent 2859ab4 commit 9fb91b6
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions Formula/lib/libmsquic.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
class Libmsquic < Formula
desc "Cross-platform, C implementation of the IETF QUIC protocol"
homepage "https://github.com/microsoft/msquic"
url "https://github.com/microsoft/msquic.git",
tag: "v2.4.4",
revision: "e87ae9a37bcebdf5ab3725e5d882ddb50e4dbbb4"
license "MIT"

depends_on "cmake" => :build
depends_on "openssl@3"

def install
args = %w[
-DQUIC_TLS=openssl3
-DQUIC_USE_SYSTEM_LIBCRYPTO=true
-DQUIC_BUILD_PERF=off
-DQUIC_BUILD_TOOLS=off
-DQUIC_BUILD_TESTS=off
-DHOMEBREW_ALLOW_FETCHCONTENT=on
]

system "cmake", "-S", ".", "-B", "build", *args, *std_cmake_args
system "cmake", "--build", "build"
system "cmake", "--install", "build"
end

test do
example = testpath/"example.cpp"
example.write <<~EOS
#include <iostream>
#include <msquic.h>
int main()
{
const QUIC_API_TABLE * ptr = {nullptr};
if (auto status = MsQuicOpen2(&ptr); QUIC_FAILED(status))
{
std::cout << "MsQuicOpen2 failed: " << status << std::endl;
return 1;
}
std::cout << "MsQuicOpen2 succeeded";
MsQuicClose(ptr);
return 0;
}
EOS
system ENV.cxx, example, "-I#{include}", "-L#{lib}", "-lmsquic", "-o", "test"
assert_equal "MsQuicOpen2 succeeded", shell_output("./test").strip
end
end

0 comments on commit 9fb91b6

Please sign in to comment.