homebrew-core/Formula/libsodium.rb

48 lines
1.3 KiB
Ruby

class Libsodium < Formula
desc "NaCl networking and cryptography library"
homepage "https://libsodium.org/"
url "https://download.libsodium.org/libsodium/releases/libsodium-1.0.18.tar.gz"
sha256 "6f504490b342a4f8a4c4a02fc9b866cbef8622d5df4e5452b46be121e46636c1"
license "ISC"
revision 1
bottle do
cellar :any
sha256 "db372521cd0b1861a5b578bee22426f3a1f4f7cb3c382be1f842da4715dc65bd" => :catalina
sha256 "55245bfcf6654b0914d3f7459b99a08c54ef2560587bf583a1c1aff4cfc81f28" => :mojave
sha256 "fc972755eb60f4221d7b32e58fc0f94e99b913fefefc84c4c76dc4bca1c5c445" => :high_sierra
end
head do
url "https://github.com/jedisct1/libsodium.git"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :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
#include <assert.h>
#include <sodium.h>
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