1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 autoreconfHook,
6 givaro,
7 pkg-config,
8 blas,
9 lapack,
10 gmpxx,
11}:
12
13assert (!blas.isILP64) && (!lapack.isILP64);
14
15stdenv.mkDerivation rec {
16 pname = "fflas-ffpack";
17 version = "2.5.0";
18
19 src = fetchFromGitHub {
20 owner = "linbox-team";
21 repo = "fflas-ffpack";
22 rev = "v${version}";
23 sha256 = "sha256-Eztc2jUyKRVUiZkYEh+IFHkDuPIy+Gx3ZW/MsuOVaMc=";
24 };
25
26 nativeCheckInputs = [
27 gmpxx
28 ];
29
30 enableParallelBuilding = true;
31
32 nativeBuildInputs = [
33 autoreconfHook
34 pkg-config
35 ]
36 ++ lib.optionals doCheck nativeCheckInputs;
37
38 buildInputs = [
39 givaro
40 blas
41 lapack
42 ];
43
44 configureFlags = [
45 "--with-blas-libs=-lcblas"
46 "--with-lapack-libs=-llapacke"
47 "--without-archnative"
48 ]
49 ++ lib.optionals stdenv.hostPlatform.isx86_64 [
50 # disable SIMD instructions (which are enabled *when available* by default)
51 # for now we need to be careful to disable *all* relevant versions of an instruction set explicitly (https://github.com/linbox-team/fflas-ffpack/issues/284)
52 "--${if stdenv.hostPlatform.sse3Support then "enable" else "disable"}-sse3"
53 "--${if stdenv.hostPlatform.ssse3Support then "enable" else "disable"}-ssse3"
54 "--${if stdenv.hostPlatform.sse4_1Support then "enable" else "disable"}-sse41"
55 "--${if stdenv.hostPlatform.sse4_2Support then "enable" else "disable"}-sse42"
56 "--${if stdenv.hostPlatform.avxSupport then "enable" else "disable"}-avx"
57 "--${if stdenv.hostPlatform.avx2Support then "enable" else "disable"}-avx2"
58 "--${if stdenv.hostPlatform.avx512Support then "enable" else "disable"}-avx512f"
59 "--${if stdenv.hostPlatform.avx512Support then "enable" else "disable"}-avx512dq"
60 "--${if stdenv.hostPlatform.avx512Support then "enable" else "disable"}-avx512vl"
61 "--${if stdenv.hostPlatform.fmaSupport then "enable" else "disable"}-fma"
62 "--${if stdenv.hostPlatform.fma4Support then "enable" else "disable"}-fma4"
63 ];
64 doCheck = true;
65
66 meta = with lib; {
67 description = "Finite Field Linear Algebra Subroutines";
68 mainProgram = "fflas-ffpack-config";
69 license = licenses.lgpl21Plus;
70 teams = [ teams.sage ];
71 platforms = platforms.unix;
72 homepage = "https://linbox-team.github.io/fflas-ffpack/";
73 };
74}