homebrew-core/Formula/cryptopp.rb
ilovezfs b10aaf25eb cryptopp 7.0.0
Closes #26333.

Signed-off-by: FX Coudert <fxcoudert@gmail.com>
2018-04-09 09:29:49 +02:00

34 lines
1 KiB
Ruby

class Cryptopp < Formula
desc "Free C++ class library of cryptographic schemes"
homepage "https://www.cryptopp.com/"
url "https://github.com/weidai11/cryptopp/archive/CRYPTOPP_7_0_0.tar.gz"
sha256 "3ee97903882b5f58c88b6f9d2ce50fd1000be95479180c7b4681cd3f4c1c7629"
# https://cryptopp.com/wiki/Config.h#Options_and_Defines
bottle :disable, "Library and clients must be built on the same microarchitecture"
def install
system "make", "shared", "all", "CXX=#{ENV.cxx}"
system "./cryptest.exe", "v"
system "make", "install", "PREFIX=#{prefix}"
end
test do
(testpath/"test.cpp").write <<~EOS
#include <cryptopp/sha.h>
#include <string>
using namespace CryptoPP;
using namespace std;
int main()
{
byte digest[SHA1::DIGESTSIZE];
string data = "Hello World!";
SHA1().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