Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, stdenv
2, fetchFromGitHub
3, fetchpatch
4, autoreconfHook
5, givaro
6, pkg-config
7, blas
8, lapack
9, fflas-ffpack
10, gmpxx
11, withSage ? false # sage support
12}:
13
14assert (!blas.isILP64) && (!lapack.isILP64);
15
16stdenv.mkDerivation rec {
17 pname = "linbox";
18 version = "1.7.0";
19
20 src = fetchFromGitHub {
21 owner = "linbox-team";
22 repo = pname;
23 rev = "v${version}";
24 sha256 = "sha256-mW84a98KPLqcHMjX3LIYTmVe0ngUdz6RJLpoDaAqKU8=";
25 };
26
27 patches = [
28 (fetchpatch {
29 url = "https://github.com/linbox-team/linbox/commit/4be26e9ef0eaf36a9909e5008940e8bf7dc625b6.patch";
30 sha256 = "PX0Tik7blXOV2vHUq92xMxaADkNoNGiax4qrjQyGK6U=";
31 })
32 ];
33
34 nativeBuildInputs = [
35 autoreconfHook
36 pkg-config
37 ];
38
39 buildInputs = [
40 givaro
41 blas
42 gmpxx
43 fflas-ffpack
44 ];
45
46 configureFlags = [
47 "--with-blas-libs=-lblas"
48 "--without-archnative"
49 ] ++ lib.optionals stdenv.isx86_64 [
50 # disable SIMD instructions (which are enabled *when available* by default)
51 "--${if stdenv.hostPlatform.sse3Support then "enable" else "disable"}-sse3"
52 "--${if stdenv.hostPlatform.ssse3Support then "enable" else "disable"}-ssse3"
53 "--${if stdenv.hostPlatform.sse4_1Support then "enable" else "disable"}-sse41"
54 "--${if stdenv.hostPlatform.sse4_2Support then "enable" else "disable"}-sse42"
55 "--${if stdenv.hostPlatform.avxSupport then "enable" else "disable"}-avx"
56 "--${if stdenv.hostPlatform.avx2Support then "enable" else "disable"}-avx2"
57 "--${if stdenv.hostPlatform.fmaSupport then "enable" else "disable"}-fma"
58 "--${if stdenv.hostPlatform.fma4Support then "enable" else "disable"}-fma4"
59 ] ++ lib.optionals withSage [
60 "--enable-sage"
61 ];
62
63 # https://github.com/linbox-team/linbox/issues/304
64 hardeningDisable = [ "fortify3" ];
65
66 doCheck = true;
67
68 enableParallelBuilding = true;
69
70 meta = with lib; {
71 description = "C++ library for exact, high-performance linear algebra";
72 mainProgram = "linbox-config";
73 license = licenses.lgpl21Plus;
74 maintainers = teams.sage.members;
75 platforms = platforms.unix;
76 homepage = "https://linalg.org/";
77 };
78}