forked from cuber/homebrew-libsecp256k1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
libsecp256k1.rb
42 lines (39 loc) · 1.17 KB
/
libsecp256k1.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
class Libsecp256k1 < Formula
desc "Optimized C library for EC operations on curve secp256k1 "
homepage "https://github.com/bitcoin/secp256k1"
url "https://github.com/bitcoin/secp256k1.git",
:revision => "6ad5cdb42a1a8257289a0423d644dcbdeab0f83c"
version "0.1"
option :universal
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
depends_on "gmp" => :optional
def install
# Outdated
# if build.universal?
# ENV.universal_binary
# end
system "./autogen.sh"
system "./configure", "--prefix=#{prefix}", "--enable-module-ecdh", "--enable-module-recovery", "--enable-experimental"
system "make", "install"
end
test do
(testpath/"test.c").write <<-EOS.undent
#include <secp256k1.h>
int main()
{
secp256k1_context *ctx =
secp256k1_context_create(SECP256K1_CONTEXT_VERIFY |
SECP256K1_CONTEXT_SIGN);
if (ctx) {
secp256k1_context_destroy(ctx);
return 0;
}
return 1;
}
EOS
system ENV.cc, "test.c", "-I#{include}", "-L#{lib}", "-lsecp256k1", "-o", "test"
system "./test"
end
end