about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/linbox
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/linbox')
-rw-r--r--nixpkgs/pkgs/development/libraries/linbox/default.nix80
-rw-r--r--nixpkgs/pkgs/development/libraries/linbox/patches/linbox-pr256-part2.patch13
2 files changed, 93 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/linbox/default.nix b/nixpkgs/pkgs/development/libraries/linbox/default.nix
new file mode 100644
index 000000000000..821edd333692
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/linbox/default.nix
@@ -0,0 +1,80 @@
+{ lib, stdenv
+, fetchFromGitHub
+, autoreconfHook
+, givaro
+, pkg-config
+, blas
+, lapack
+, fflas-ffpack
+, gmpxx
+, withSage ? false # sage support
+}:
+
+assert (!blas.isILP64) && (!lapack.isILP64);
+
+stdenv.mkDerivation rec {
+  pname = "linbox";
+  version = "1.6.3"; # TODO: Check postPatch script on update
+
+  src = fetchFromGitHub {
+    owner = "linbox-team";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "10j6dspbsq7d2l4q3y0c1l1xwmaqqba2fxg59q5bhgk9h5d7q571";
+  };
+
+  nativeBuildInputs = [
+    autoreconfHook
+    pkg-config
+  ];
+
+  buildInputs = [
+    givaro
+    blas
+    gmpxx
+    fflas-ffpack
+  ];
+
+  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 {} \;
+  '';
+
+  configureFlags = [
+    "--with-blas-libs=-lblas"
+    "--disable-optimization"
+  ] ++ lib.optionals stdenv.isx86_64 [
+    # disable SIMD instructions (which are enabled *when available* by default)
+    "--${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"
+  ] ++ lib.optionals withSage [
+    "--enable-sage"
+  ];
+
+  doCheck = true;
+
+  enableParallelBuilding = true;
+
+  meta = with lib; {
+    description = "C++ library for exact, high-performance linear algebra";
+    license = licenses.lgpl21Plus;
+    maintainers = teams.sage.members;
+    platforms = platforms.unix;
+    homepage = "https://linalg.org/";
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/linbox/patches/linbox-pr256-part2.patch b/nixpkgs/pkgs/development/libraries/linbox/patches/linbox-pr256-part2.patch
new file mode 100644
index 000000000000..ec8571a7d710
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/linbox/patches/linbox-pr256-part2.patch
@@ -0,0 +1,13 @@
+--- a/linbox/algorithms/det-rational.h
++++ b/linbox/algorithms/det-rational.h
+@@ -79,8 +79,8 @@
+ 	struct MyRationalModularDet {
+ 		const Blackbox &A;
+ 		const MyMethod &M;
+-		const Integer &mul;//multiplicative prec;
+-		const Integer ÷
++		Integer mul;//multiplicative prec;
++		Integer div;
+ 
+ 		MyRationalModularDet(const Blackbox& b, const MyMethod& n,
+ 				     const Integer & p1, const Integer & p2) :