class Libsodium < Formula desc "NaCl networking and cryptography library" homepage "https://libsodium.org/" url "https://download.libsodium.org/libsodium/releases/libsodium-1.0.20.tar.gz" sha256 "ebb65ef6ca439333c2bb41a0c1990587288da07f6c7fd07cb3a18cc18d30ce19" license "ISC" livecheck do url "https://download.libsodium.org/libsodium/releases/" regex(/href=.*?libsodium[._-]v?(\d+(?:\.\d+)+)\.t/i) end head do url "https://github.com/jedisct1/libsodium.git", branch: "master" depends_on "autoconf" => :build depends_on "automake" => :build depends_on "libtool" => :build end def install system "./autogen.sh", "-sb" 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 #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