2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv
|
2020-04-24 23:36:52 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, autoreconfHook
|
|
|
|
, givaro
|
2021-02-05 17:12:51 +00:00
|
|
|
, pkg-config
|
2020-04-24 23:36:52 +00:00
|
|
|
, blas
|
|
|
|
, lapack
|
|
|
|
, fflas-ffpack
|
|
|
|
, gmpxx
|
|
|
|
, withSage ? false # sage support
|
|
|
|
}:
|
|
|
|
|
|
|
|
assert (!blas.isILP64) && (!lapack.isILP64);
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "linbox";
|
2020-11-06 00:33:48 +00:00
|
|
|
version = "1.6.3"; # TODO: Check postPatch script on update
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "linbox-team";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "10j6dspbsq7d2l4q3y0c1l1xwmaqqba2fxg59q5bhgk9h5d7q571";
|
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
autoreconfHook
|
2021-02-05 17:12:51 +00:00
|
|
|
pkg-config
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
givaro
|
|
|
|
blas
|
|
|
|
gmpxx
|
|
|
|
fflas-ffpack
|
|
|
|
];
|
|
|
|
|
2020-11-06 00:33:48 +00:00
|
|
|
patches = [
|
|
|
|
# Remove inappropriate `const &` qualifiers on data members that can be
|
|
|
|
# modified via member functions.
|
|
|
|
# See also: https://github.com/linbox-team/linbox/pull/256
|
|
|
|
./patches/linbox-pr256-part2.patch # TODO: Remove on 1.7.0 update
|
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
# Remove @LINBOXSAGE_LIBS@ that is actually undefined.
|
|
|
|
# See also: https://github.com/linbox-team/linbox/pull/249
|
|
|
|
# TODO: Remove on 1.7.0 update
|
|
|
|
find . -type f -exec sed -e 's/@LINBOXSAGE_LIBS@//' -i {} \;
|
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
configureFlags = [
|
|
|
|
"--with-blas-libs=-lblas"
|
|
|
|
"--disable-optimization"
|
2021-02-05 17:12:51 +00:00
|
|
|
] ++ lib.optionals stdenv.isx86_64 [
|
2020-04-24 23:36:52 +00:00
|
|
|
# disable SIMD instructions (which are enabled *when available* by default)
|
2020-09-25 04:45:31 +00:00
|
|
|
"--${if stdenv.hostPlatform.sse3Support then "enable" else "disable"}-sse3"
|
|
|
|
"--${if stdenv.hostPlatform.ssse3Support then "enable" else "disable"}-ssse3"
|
|
|
|
"--${if stdenv.hostPlatform.sse4_1Support then "enable" else "disable"}-sse41"
|
|
|
|
"--${if stdenv.hostPlatform.sse4_2Support then "enable" else "disable"}-sse42"
|
|
|
|
"--${if stdenv.hostPlatform.avxSupport then "enable" else "disable"}-avx"
|
|
|
|
"--${if stdenv.hostPlatform.avx2Support then "enable" else "disable"}-avx2"
|
|
|
|
"--${if stdenv.hostPlatform.fmaSupport then "enable" else "disable"}-fma"
|
|
|
|
"--${if stdenv.hostPlatform.fma4Support then "enable" else "disable"}-fma4"
|
2021-02-05 17:12:51 +00:00
|
|
|
] ++ lib.optionals withSage [
|
2020-04-24 23:36:52 +00:00
|
|
|
"--enable-sage"
|
|
|
|
];
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "C++ library for exact, high-performance linear algebra";
|
2020-11-21 19:51:51 +00:00
|
|
|
license = licenses.lgpl21Plus;
|
|
|
|
maintainers = teams.sage.members;
|
|
|
|
platforms = platforms.unix;
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://linalg.org/";
|
|
|
|
};
|
|
|
|
}
|