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 4b170e6 commit dfc99b9
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions Formula/lib/libmsquic.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
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
-DFETCHCONTENT_FULLY_DISCONNECTED=ON
-DFETCHCONTENT_TRY_FIND_PACKAGE_MODE=ALWAYS
]

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 dfc99b9

Please sign in to comment.