homebrew-core/Formula/ntl.rb

51 lines
1.2 KiB
Ruby

class Ntl < Formula
desc "C++ number theory library"
homepage "http://www.shoup.net/ntl"
url "http://www.shoup.net/ntl/ntl-10.5.0.tar.gz"
sha256 "b90b36c9dd8954c9bc54410b1d57c00be956ae1db5a062945822bbd7a86ab4d2"
bottle do
cellar :any
sha256 "d3b7cb343a1b590d0e21cbac76ffa40d59dfd59986aa5cd6c8234c7a9797e4be" => :high_sierra
sha256 "34e952fe458afc912c0822a3db858b843270dc4b6bea3b73eac52b3b29761d77" => :sierra
sha256 "d34ad4f67e21327db85b1007626f77f6e5c87857707b53a3419dce6886418331" => :el_capitan
end
depends_on "gmp"
def install
args = ["PREFIX=#{prefix}", "SHARED=on"]
cd "src" do
system "./configure", *args
system "make"
system "make", "install"
end
end
test do
(testpath/"square.cc").write <<~EOS
#include <iostream>
#include <NTL/ZZ.h>
int main()
{
NTL::ZZ a;
std::cin >> a;
std::cout << NTL::power(a, 2);
return 0;
}
EOS
gmp = Formula["gmp"]
flags = %W[
-I#{include}
-L#{gmp.opt_lib}
-L#{lib}
-lntl
-lgmp
]
system ENV.cxx, "square.cc", "-o", "square", *flags
assert_equal "4611686018427387904", pipe_output("./square", "2147483648")
end
end