-
-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |