1{ lib
2, stdenv
3, fetchurl
4, gmp
5, mpir
6, mpfr
7, ntl
8, openblas ? null, blas, lapack
9, withBlas ? true
10}:
11
12assert withBlas -> openblas != null && blas.implementation == "openblas" && lapack.implementation == "openblas";
13
14stdenv.mkDerivation rec {
15 pname = "flint";
16 version = "2.9.0";
17
18 src = fetchurl {
19 url = "https://www.flintlib.org/flint-${version}.tar.gz";
20 sha256 = "sha256-L8CQ1RAzyTII5sENQGOXpTyYOuU0O5WOsl9ypXpM52o=";
21 };
22
23 buildInputs = [
24 gmp
25 mpir
26 mpfr
27 ntl
28 ] ++ lib.optionals withBlas [
29 openblas
30 ];
31
32 propagatedBuildInputs = [
33 mpfr # flint.h includes mpfr.h
34 ];
35
36 configureFlags = [
37 "--with-gmp=${gmp}"
38 "--with-mpir=${mpir}"
39 "--with-mpfr=${mpfr}"
40 "--with-ntl=${ntl}"
41 ] ++ lib.optionals withBlas [
42 "--with-blas=${openblas}"
43 ];
44
45 enableParallelBuilding = true;
46
47 doCheck = true;
48
49 meta = with lib; {
50 description = "Fast Library for Number Theory";
51 license = licenses.gpl2Plus;
52 maintainers = teams.sage.members;
53 platforms = platforms.unix;
54 homepage = "https://www.flintlib.org/";
55 downloadPage = "https://www.flintlib.org/downloads.html";
56 };
57}