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 3d6f981 commit e12b827
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions Formula/lib/libmsquic.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
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
system "cmake", "-B", "build/openssl3",
"-DQUIC_OUTPUT_DIR=../../../artifacts/bin/Release_openssl3",
"-DCMAKE_BUILD_TYPE=Release", "-DQUIC_TLS=openssl3",
"-DQUIC_USE_SYSTEM_LIBCRYPTO=true", "-DQUIC_BUILD_PERF=off",
"-DQUIC_BUILD_TOOLS=off"
system "cmake", "--build", "build/openssl3"
system "cmake", "--install", "build/openssl3", "--prefix", prefix
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); static_cast<int>(status) > 0)
{
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 e12b827

Please sign in to comment.