class Libsodium < Formula desc "NaCl networking and cryptography library" homepage "https://github.com/jedisct1/libsodium/" url "https://github.com/jedisct1/libsodium/releases/download/1.0.12/libsodium-1.0.12.tar.gz" sha256 "b8648f1bb3a54b0251cf4ffa4f0d76ded13977d4fa7517d988f4c902dd8e2f95" bottle do cellar :any sha256 "e05aba6c665a7a5de297e135568882b6706728ce25820d609a6984b09b69086e" => :sierra sha256 "4737a478ca227bc156890cafae1df4c200591bc217866f38ebdf0f02360790e2" => :el_capitan sha256 "9e9925521bf75dd77192596713a16b3bae27037e2bca6886a0b805ddc90c2cca" => :yosemite sha256 "dc0d77998561c0eaee3d3bf934d9479f6cbfad2b47cc1bbf5b28de4d59575e1d" => :mavericks end head do url "https://github.com/jedisct1/libsodium.git" depends_on "libtool" => :build depends_on "autoconf" => :build depends_on "automake" => :build end def install 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 #include int main() { assert(sodium_init() != -1); return 0; } EOS system ENV.cc, "test.c", "-I#{include}", "-L#{lib}", "-lsodium", "-o", "test" system "./test" end end