Skip to content

Commit 224ecbc

Browse files
alebcaydaeho-ro
authored andcommitted
libaegis 0.4.5 (new formula)
1 parent 5ae0d63 commit 224ecbc

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

Formula/lib/libaegis.rb

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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+
# Workaround for arm64 linux without -march `sha3`
12+
ENV.append_to_cflags "-march=native" if OS.linux? && Hardware::CPU.arm?
13+
14+
system "cmake", "-S", ".", "-B", "build", "-DBUILD_SHARED_LIBS=ON", *std_cmake_args
15+
system "cmake", "--build", "build"
16+
system "cmake", "--install", "build"
17+
end
18+
19+
test do
20+
(testpath/"test.c").write <<~EOS
21+
#include <stdio.h>
22+
#include <aegis.h>
23+
24+
int main() {
25+
int result = aegis_init();
26+
if (result != 0) {
27+
printf("aegis_init failed with result %d\\n", result);
28+
return 1;
29+
} else {
30+
printf("aegis_init succeeded\\n");
31+
return 0;
32+
}
33+
}
34+
EOS
35+
36+
system ENV.cc, "test.c", "-I#{include}", "-L#{lib}", "-laegis", "-o", "test"
37+
system "./test"
38+
end
39+
end

0 commit comments

Comments
 (0)