Skip to content

Commit 67ec1ff

Browse files
committed
libaegis 0.4.5 (new formula)
1 parent 5ae0d63 commit 67ec1ff

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

Formula/lib/libaegis.rb

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
class Libaegis < Formula
2+
desc "Portable C implementations of the AEGIS family of encryption algorithms"
3+
homepage "https://github.com/aegis-aead/libaegis"
4+
url "https://github.com/aegis-aead/libaegis/archive/refs/tags/0.4.5.tar.gz"
5+
sha256 "ce855320369f5e46d4c3512bf28a0cb8b8260b6d079b6b9bfda61ccd452fe9ce"
6+
license "MIT"
7+
8+
depends_on "cmake" => :build
9+
10+
def install
11+
# The library contains multiple implementations, from which the most optimal is
12+
# selected at runtime, see https://github.com/aegis-aead/libaegis/blob/main/src/common/cpu.c
13+
ENV.runtime_cpu_detection
14+
15+
system "cmake", "-S", ".", "-B", "build", "-DBUILD_SHARED_LIBS=ON", *std_cmake_args
16+
system "cmake", "--build", "build"
17+
system "cmake", "--install", "build"
18+
end
19+
20+
test do
21+
(testpath/"test.c").write <<~EOS
22+
#include <stdio.h>
23+
#include <aegis.h>
24+
25+
int main() {
26+
int result = aegis_init();
27+
if (result != 0) {
28+
printf("aegis_init failed with result %d\\n", result);
29+
return 1;
30+
} else {
31+
printf("aegis_init succeeded\\n");
32+
return 0;
33+
}
34+
}
35+
EOS
36+
37+
system ENV.cc, "-I#{include}", "-L#{lib}", "-laegis", "-o", "test", "test.c"
38+
system "./test"
39+
end
40+
end

style_exceptions/runtime_cpu_detection_allowlist.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"groestlcoin",
1515
"handbrake",
1616
"highway",
17+
"libaegis",
1718
"libpq",
1819
"libpq@16",
1920
"libpq@17",

0 commit comments

Comments
 (0)