homebrew-core/Formula/ntl.rb
Michka Popoff 3ed0441f84 ntl: invert library flags in test (#15496)
Fixes build error of the test in Linuxbrew:
/home/linuxbrew/.linuxbrew/Cellar/ntl/10.4.0/lib/libntl.a(lip.o):
In function redc': /tmp/ntl-20170709-39012-9xndg8/ntl-10.4.0/src/lip.cpp:5012: undefined reference to__gmpn_addmul_1'
/tmp/ntl-20170709-39012-9xndg8/ntl-10.4.0/src/lip.cpp:5024: undefined reference to `__gmpn_sub_n'

This changes nothing for the mac build, it is just to
keep both versions as much in sync as possible.
2017-07-10 22:55:33 -07:00

51 lines
1.3 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"
bottle do
cellar :any_skip_relocation
sha256 "72c79a85c49ce2f21d8c051cf8fa89e51fbe5a433192ed0d1fcb3a351070a3cb" => :sierra
sha256 "90ad337da72230a12d67e963656e28dd42af80d0410a0d1fb62c81db7ef9372d" => :el_capitan
sha256 "a4688eec8932344ed3b399239271a1dbc0a4ee9df0ebec5413dded452e90a9ad" => :yosemite
end
depends_on "gmp"
def install
args = ["PREFIX=#{prefix}"]
cd "src" do
system "./configure", *args
system "make"
system "make", "check"
system "make", "install"
end
end
test do
(testpath/"square.cc").write <<-EOS.undent
#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