1{ lib, stdenv, fetchFromGitHub, autoreconfHook, givaro, pkg-config, blas, lapack
2, gmpxx
3}:
4
5assert (!blas.isILP64) && (!lapack.isILP64);
6
7stdenv.mkDerivation rec {
8 pname = "fflas-ffpack";
9 version = "2.5.0";
10
11 src = fetchFromGitHub {
12 owner = "linbox-team";
13 repo = pname;
14 rev = "v${version}";
15 sha256 = "sha256-Eztc2jUyKRVUiZkYEh+IFHkDuPIy+Gx3ZW/MsuOVaMc=";
16 };
17
18 nativeCheckInputs = [
19 gmpxx
20 ];
21
22 enableParallelBuilding = true;
23
24 nativeBuildInputs = [
25 autoreconfHook
26 pkg-config
27 ] ++ lib.optionals doCheck nativeCheckInputs;
28
29 buildInputs = [ givaro blas lapack ];
30
31 configureFlags = [
32 "--with-blas-libs=-lcblas"
33 "--with-lapack-libs=-llapacke"
34 ] ++ lib.optionals stdenv.isx86_64 [
35 # disable SIMD instructions (which are enabled *when available* by default)
36 # 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)
37 "--${if stdenv.hostPlatform.sse3Support then "enable" else "disable"}-sse3"
38 "--${if stdenv.hostPlatform.ssse3Support then "enable" else "disable"}-ssse3"
39 "--${if stdenv.hostPlatform.sse4_1Support then "enable" else "disable"}-sse41"
40 "--${if stdenv.hostPlatform.sse4_2Support then "enable" else "disable"}-sse42"
41 "--${if stdenv.hostPlatform.avxSupport then "enable" else "disable"}-avx"
42 "--${if stdenv.hostPlatform.avx2Support then "enable" else "disable"}-avx2"
43 "--${if stdenv.hostPlatform.avx512Support then "enable" else "disable"}-avx512f"
44 "--${if stdenv.hostPlatform.avx512Support then "enable" else "disable"}-avx512dq"
45 "--${if stdenv.hostPlatform.avx512Support then "enable" else "disable"}-avx512vl"
46 "--${if stdenv.hostPlatform.fmaSupport then "enable" else "disable"}-fma"
47 "--${if stdenv.hostPlatform.fma4Support then "enable" else "disable"}-fma4"
48 ];
49 doCheck = true;
50
51 meta = with lib; {
52 broken = stdenv.isDarwin;
53 description = "Finite Field Linear Algebra Subroutines";
54 license = licenses.lgpl21Plus;
55 maintainers = teams.sage.members;
56 platforms = platforms.unix;
57 homepage = "https://linbox-team.github.io/fflas-ffpack/";
58 };
59}