homebrew-core/Formula/cryptopp.rb
Xu Cheng 422cf94776 cryptopp: modernize and add test
Closes Homebrew/homebrew#39099.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-04-27 17:16:00 +08:00

31 lines
889 B
Ruby

class Cryptopp < Formula
homepage "http://www.cryptopp.com/"
url "https://downloads.sourceforge.net/project/cryptopp/cryptopp/5.6.2/cryptopp562.zip"
mirror "http://www.cryptopp.com/cryptopp562.zip"
sha256 "5cbfd2fcb4a6b3aab35902e2e0f3b59d9171fee12b3fc2b363e1801dfec53574"
version "5.6.2"
def install
system "make", "CXX=#{ENV.cxx}"
system "make", "install", "PREFIX=#{prefix}"
end
test do
(testpath/"test.cpp").write <<-EOS.undent
#include <cryptopp/sha.h>
#include <string>
using namespace CryptoPP;
using namespace std;
int main()
{
byte digest[SHA::DIGESTSIZE];
string data = "Hello World!";
SHA().CalculateDigest(digest, (byte*) data.c_str(), data.length());
return 0;
}
EOS
system ENV.cxx, "test.cpp", "-L#{lib}", "-lcryptopp", "-o", "test"
system "./test"
end
end