class Cryptopp < Formula desc "Free C++ class library of cryptographic schemes" homepage "https://www.cryptopp.com/" url "https://downloads.sourceforge.net/project/cryptopp/cryptopp/5.6.4/cryptopp564.zip" version "5.6.4" sha256 "be430377b05c15971d5ccb6e44b4d95470f561024ed6d701fe3da3a188c84ad7" # https://cryptopp.com/wiki/Config.h#Options_and_Defines bottle :disable, "Library and clients must be built on the same microarchitecture" option :cxx11 def install ENV.cxx11 if build.cxx11? system "make", "shared", "all", "CXX=#{ENV.cxx}" system "./cryptest.exe", "v" system "make", "install", "PREFIX=#{prefix}" end test do (testpath/"test.cpp").write <<-EOS.undent #include #include 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 ENV.cxx11 if build.cxx11? system ENV.cxx, "test.cpp", "-L#{lib}", "-lcryptopp", "-o", "test" system "./test" end end