homebrew-core/Formula/flint.rb

66 lines
1.8 KiB
Ruby

class Flint < Formula
desc "C library for number theory"
homepage "http://flintlib.org"
url "http://flintlib.org/flint-2.6.3.tar.gz"
sha256 "ce1a750a01fa53715cad934856d4b2ed76f1d1520bac0527ace7d5b53e342ee3"
license "LGPL-2.1-or-later"
revision 1
head "https://github.com/wbhart/flint2.git", branch: "trunk"
bottle do
sha256 "8f03bf2f3e4054c196b5d7a593b5d3e18b85a0482a9b919ec3939db9a0712ef1" => :catalina
sha256 "af9627560e4128bf27fd088400890595d886dcc52cb6f752ecfe44738ab893bc" => :mojave
sha256 "072f386f8b52bf213fb7782c562ee92b179ceb304b83e18a208e762fcbc8dd1f" => :high_sierra
end
depends_on "gmp"
depends_on "mpfr"
depends_on "ntl"
def install
ENV.cxx11
args = %W[
--with-gmp=#{Formula["gmp"].prefix}
--with-mpfr=#{Formula["mpfr"].prefix}
--with-ntl=#{Formula["ntl"].prefix}
--prefix=#{prefix}
]
system "./configure", *args
system "make"
system "make", "install"
end
test do
(testpath/"test.c").write <<-EOS
#include <stdlib.h>
#include <stdio.h>
#include <flint/flint.h>
#include <flint/fmpz_mod_poly.h>
int main(int argc, char* argv[])
{
fmpz_t n;
fmpz_mod_poly_t x, y;
fmpz_init_set_ui(n, 7);
fmpz_mod_poly_init(x, n);
fmpz_mod_poly_init(y, n);
fmpz_mod_poly_set_coeff_ui(x, 3, 5);
fmpz_mod_poly_set_coeff_ui(x, 0, 6);
fmpz_mod_poly_sqr(y, x);
fmpz_mod_poly_print(x); flint_printf("\\n");
fmpz_mod_poly_print(y); flint_printf("\\n");
fmpz_mod_poly_clear(x);
fmpz_mod_poly_clear(y);
fmpz_clear(n);
return EXIT_SUCCESS;
}
EOS
system ENV.cc, "test.c", "-I#{include}/flint", "-L#{lib}", "-L#{Formula["gmp"].lib}",
"-lflint", "-lgmp", "-o", "test"
system "./test"
end
end