flint 2.5.2 (new formula)

Revived from homebrew-science.

d2b0623922/flint.rb

Closes #48001.

Signed-off-by: Rui Chen <chenrui333@gmail.com>
This commit is contained in:
Zhiming Wang 2019-12-18 16:04:26 +08:00 committed by Rui Chen
parent 5818528939
commit facf90119e

49
Formula/flint.rb Normal file
View file

@ -0,0 +1,49 @@
class Flint < Formula
desc "C library for number theory"
homepage "http://flintlib.org"
url "http://flintlib.org/flint-2.5.2.tar.gz"
sha256 "cbf1fe0034533c53c5c41761017065f85207a1b770483e98b2392315f6575e87"
head "https://github.com/wbhart/flint2.git", :branch => "trunk"
depends_on "gmp"
depends_on "mpfr"
def install
system "./configure", "--prefix=#{prefix}"
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