homebrew-core/Formula/flint.rb
2019-12-21 09:36:13 -05:00

56 lines
1.6 KiB
Ruby

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"
bottle do
cellar :any
sha256 "f6df4b3a018320efc58b97580af06979ade00007812c6deb83ba150911f1bff9" => :catalina
sha256 "464d909acc9801c865e85023ab33db1abea9e9a28f81808979d7650370d67417" => :mojave
sha256 "952ffcbee931dc8554a69b2828b6ac0293e3981223762eeff0dabab42e365d0a" => :high_sierra
end
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