-
Notifications
You must be signed in to change notification settings - Fork 82
/
libsodiumjni.rb
53 lines (45 loc) · 1.38 KB
/
libsodiumjni.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
43
44
45
46
47
48
49
50
51
52
class Libsodiumjni < Formula
desc "NaCl networking and cryptography library"
homepage "https://github.com/joshjdevl/libsodium-jni/"
url "https://github.com/joshjdevl/libsodium-jni/archive/a36b21fd15660651bfc59168e0f297e007121797.zip"
head do
url "https://github.com/joshjdevl/libsodium-jni.git"
depends_on "libtool" => :build
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "swig" => :build
depends_on "android-sdk" => :build
depends_on "android-ndk" => :build
depends_on "gradle" => :build
depends_on "libsodium" => :build
depends_on "maven" => :build
end
option :universal
def install
ENV.universal_binary if build.universal?
system "cd jni && ./compile.sh"
system "mvn -q clean install"
system "./singleTest.sh"
system "echo `pwd`"
system "ndk-build"
system "gradle build"
#system "./autogen.sh" if build.head?
#system "./configure", "--disable-debug", "--disable-dependency-tracking",
# "--prefix=#{prefix}"
#system "make", "check"
#system "make", "install"
end
test do
(testpath/"test.c").write <<-EOS.undent
#include <assert.h>
#include <sodium.h>
int main()
{
assert(sodium_init() != -1);
return 0;
}
EOS
system ENV.cc, "test.c", "-lsodium", "-o", "test"
system "./test"
end
end