51 lines
1.2 KiB
Ruby
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.4.0.tar.gz"
|
|
sha256 "ed72cbfd8318d149ea9ec3a841fc5686f68d0f72e70602d59dd034cde43fab6f"
|
|
revision 1
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "7702e17867e579b38c4974d582850663b3e3c403cdf9ef5b77a5db896b944b10" => :high_sierra
|
|
sha256 "d9b20565ae0862fdc62d867882e8d32d0c612f1037b98188f759db6c52748336" => :sierra
|
|
sha256 "0566652f2c4f2180e8590b1fdcf826da556362998060cc2a2ef4cc73586ebee9" => :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
|