summary refs log tree commit diff
path: root/pkgs/applications/science/math
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/science/math')
-rw-r--r--pkgs/applications/science/math/bliss/default.nix4
-rw-r--r--pkgs/applications/science/math/clp/default.nix32
-rw-r--r--pkgs/applications/science/math/gurobi/default.nix48
-rw-r--r--pkgs/applications/science/math/nasc/default.nix34
-rw-r--r--pkgs/applications/science/math/sage/default.nix39
-rw-r--r--pkgs/applications/science/math/sage/patches/eclib-20180710.patch40
-rw-r--r--pkgs/applications/science/math/sage/patches/revert-269c1e1551285.patch14
-rw-r--r--pkgs/applications/science/math/sage/sage-src.nix16
-rw-r--r--pkgs/applications/science/math/sage/sagenb.nix8
9 files changed, 165 insertions, 70 deletions
diff --git a/pkgs/applications/science/math/bliss/default.nix b/pkgs/applications/science/math/bliss/default.nix
index b96aa60da686..1b7a97360079 100644
--- a/pkgs/applications/science/math/bliss/default.nix
+++ b/pkgs/applications/science/math/bliss/default.nix
@@ -21,11 +21,11 @@ stdenv.mkDerivation rec {
   '';
 
   installPhase = ''
-    mkdir -p $out/bin $out/share/doc/bliss $out/lib $out/include
+    mkdir -p $out/bin $out/share/doc/bliss $out/lib $out/include/bliss
     mv bliss $out/bin 
     mv html/* COPYING* $out/share/doc/bliss
     mv *.a $out/lib
-    mv *.h *.hh $out/include
+    mv *.h *.hh $out/include/bliss
   '';
 
   meta = with stdenv.lib; {
diff --git a/pkgs/applications/science/math/clp/default.nix b/pkgs/applications/science/math/clp/default.nix
index daa9a53c59a1..4899ebe42d77 100644
--- a/pkgs/applications/science/math/clp/default.nix
+++ b/pkgs/applications/science/math/clp/default.nix
@@ -1,24 +1,22 @@
 { stdenv, fetchurl, zlib }:
 
 stdenv.mkDerivation rec {
-	version = "1.16.11";
-	name = "clp-${version}";
-	src = fetchurl {
-		url = "https://www.coin-or.org/download/source/Clp/Clp-${version}.tgz";
-		sha256 = "0fazlqpp845186nmixa9f1xfxqqkdr1xj4va7q29m8594ca4a9dm";
-	};
+  version = "1.16.11";
+  name = "clp-${version}";
+  src = fetchurl {
+    url = "https://www.coin-or.org/download/source/Clp/Clp-${version}.tgz";
+    sha256 = "0fazlqpp845186nmixa9f1xfxqqkdr1xj4va7q29m8594ca4a9dm";
+  };
 
-	propagatedBuildInputs = [ zlib ];
+  propagatedBuildInputs = [ zlib ];
 
-	doCheck = true;
+  doCheck = true;
 
-	checkTarget = "test";
-
-	meta = {
-		license = stdenv.lib.licenses.epl10;
-		homepage = https://projects.coin-or.org/Clp;
-		description = "An open-source linear programming solver written in C++";
-		platforms = stdenv.lib.platforms.all;
-		maintainers = [ stdenv.lib.maintainers.vbgl ];
-	};
+  meta = {
+    license = stdenv.lib.licenses.epl10;
+    homepage = https://projects.coin-or.org/Clp;
+    description = "An open-source linear programming solver written in C++";
+    platforms = stdenv.lib.platforms.all;
+    maintainers = [ stdenv.lib.maintainers.vbgl ];
+  };
 }
diff --git a/pkgs/applications/science/math/gurobi/default.nix b/pkgs/applications/science/math/gurobi/default.nix
new file mode 100644
index 000000000000..06d448f6252e
--- /dev/null
+++ b/pkgs/applications/science/math/gurobi/default.nix
@@ -0,0 +1,48 @@
+{ stdenv, fetchurl, autoPatchelfHook, python }:
+
+stdenv.mkDerivation rec {
+  name = "gurobi-${version}";
+  version = "8.0.1";
+
+  src = with stdenv.lib; fetchurl {
+    url = "http://packages.gurobi.com/${versions.majorMinor version}/gurobi${version}_linux64.tar.gz";
+    sha256 = "0y3lb0mngnyn7ql4s2n8qxnr1d2xcjdpdhpdjdxc4sc8f2w2ih18";
+  };
+
+  sourceRoot = "gurobi${builtins.replaceStrings ["."] [""] version}/linux64";
+
+  nativeBuildInputs = [ autoPatchelfHook ];
+  buildInputs = [ (python.withPackages (ps: [ ps.gurobipy ])) ];
+
+  buildPhase = ''
+    cd src/build
+    make
+    cd ../..
+  '';
+
+  installPhase = ''
+    mkdir -p $out/bin
+    cp bin/* $out/bin/
+    rm $out/bin/gurobi.env
+    rm $out/bin/gurobi.sh
+    rm $out/bin/python2.7
+
+    cp lib/gurobi.py $out/bin/gurobi.sh
+
+    mkdir -p $out/include
+    cp include/gurobi*.h $out/include/
+
+    mkdir -p $out/lib
+    cp lib/libgurobi*.so* $out/lib/
+    cp lib/libgurobi*.a $out/lib/
+    cp src/build/*.a $out/lib/
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Optimization solver for mathematical programming";
+    homepage = https://www.gurobi.com;
+    license = licenses.unfree;
+    platforms = [ "x86_64-linux" ];
+    maintainers = with maintainers; [ jfrankenau ];
+  };
+}
diff --git a/pkgs/applications/science/math/nasc/default.nix b/pkgs/applications/science/math/nasc/default.nix
index 8efe8d9da941..cac403b131b8 100644
--- a/pkgs/applications/science/math/nasc/default.nix
+++ b/pkgs/applications/science/math/nasc/default.nix
@@ -1,8 +1,6 @@
 { stdenv
-, bash
-, gnused
 , fetchFromGitHub
-, gettext
+, fetchpatch
 , pkgconfig
 , gtk3
 , granite
@@ -11,23 +9,30 @@
 , ninja
 , vala
 , libqalculate
-, elementary-cmake-modules
+, gobjectIntrospection
 , wrapGAppsHook }:
 
 stdenv.mkDerivation rec {
   name = "nasc-${version}";
-  version = "0.4.6";
+  version = "0.4.7";
 
   src = fetchFromGitHub {
     owner = "parnold-x";
     repo = "nasc";
     rev = version;
-    sha256 = "01n4ldj5phrsv97vb04qvs9c1ip6v8wygx9llj704hly1il9fb54";
+    sha256 = "0p74953pdgsijvqj3msssqiwm6sc1hzp68dlmjamqrqirwgqv5aa";
   };
 
-  XDG_DATA_DIRS = stdenv.lib.concatStringsSep ":" [
-    "${granite}/share"
-    "${gnome3.libgee}/share"
+  patches = [
+    # Install libqalculatenasc.so
+    (fetchpatch {
+      url = https://github.com/parnold-x/nasc/commit/93a799f9afb3e32f3f1a54e056b59570aae2e437.patch;
+      sha256 = "1m32w2zaswzxnzbr7p3lf8s6fac4mjvfhm8v9k59b4jyzmvrl631";
+    })
+    (fetchpatch {
+      url = https://github.com/parnold-x/nasc/commit/570b49169326de154af2cf43c5f12268fff1dc6d.patch;
+      sha256 = "1y3w6rxn0453iscx2xg427wy1bd5kv4z1c41hhbjmg614ycp6bka";
+    })
   ];
 
   nativeBuildInputs = [
@@ -35,7 +40,8 @@ stdenv.mkDerivation rec {
     wrapGAppsHook
     vala
     cmake
-    gettext
+    ninja
+    gobjectIntrospection # for setup-hook
   ];
   buildInputs = [
     libqalculate
@@ -46,14 +52,6 @@ stdenv.mkDerivation rec {
     gnome3.gtksourceview
   ];
 
-  prePatch = ''
-    substituteInPlace ./libqalculatenasc/libtool \
-      --replace "/bin/bash" "${bash}/bin/bash" \
-      --replace "/bin/sed" "${gnused}/bin/sed"
-    substituteInPlace ./libqalculatenasc/configure.inc \
-      --replace 'ac_default_path="/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin"' 'ac_default_path=$PATH'
-  '';
-
   meta = with stdenv.lib; {
     description = "Do maths like a normal person";
     longDescription = ''
diff --git a/pkgs/applications/science/math/sage/default.nix b/pkgs/applications/science/math/sage/default.nix
index 9ad112213ffd..1f540cc2b287 100644
--- a/pkgs/applications/science/math/sage/default.nix
+++ b/pkgs/applications/science/math/sage/default.nix
@@ -14,16 +14,6 @@ let
 
       cvxopt = super.cvxopt.override { inherit glpk; };
 
-      # https://github.com/sagemath/sagenb/issues/437
-      flask-babel = super.flask-babel.overridePythonAttrs (attrs: rec {
-        version = "0.9";
-        src = attrs.src.override {
-          inherit version;
-          sha256 = "0k7vk4k54y55ma0nx2k5s0phfqbriwslhy5shh3b0d046q7ibzaa";
-        };
-        doCheck = false;
-      });
-
       # python packages that appear unmaintained and were not accepted into the nixpkgs
       # tree because of that. These packages are only dependencies of the more-or-less
       # deprecated sagenb. However sagenb is still a default dependency and the doctests
@@ -36,7 +26,7 @@ let
       pybrial = self.callPackage ./pybrial.nix {};
 
       sagelib = self.callPackage ./sagelib.nix {
-        inherit flint ecl pari glpk eclib;
+        inherit flint ecl pari glpk eclib ntl arb;
         inherit sage-src openblas-blas-pc openblas-cblas-pc openblas-lapack-pc pynac singular;
         linbox = nixpkgs.linbox.override { withSage = true; };
       };
@@ -57,13 +47,13 @@ let
       };
 
       sage-env = self.callPackage ./sage-env.nix {
-        inherit sage-src python rWrapper openblas-cblas-pc glpk ecl singular eclib pari palp flint pynac pythonEnv;
+        inherit sage-src python rWrapper openblas-cblas-pc glpk ecl singular eclib pari palp flint pynac pythonEnv giac ntl;
         pkg-config = nixpkgs.pkgconfig; # not to confuse with pythonPackages.pkgconfig
       };
 
       sage-with-env = self.callPackage ./sage-with-env.nix {
-        inherit pari eclib pythonEnv;
-        inherit sage-src openblas-blas-pc openblas-cblas-pc openblas-lapack-pc pynac singular;
+        inherit pari eclib pythonEnv ntl;
+        inherit sage-src openblas-blas-pc openblas-cblas-pc openblas-lapack-pc pynac singular giac;
         pkg-config = nixpkgs.pkgconfig; # not to confuse with pythonPackages.pkgconfig
         three = nodePackages_8_x.three;
       };
@@ -118,10 +108,23 @@ let
     });
   };
 
+  # https://trac.sagemath.org/ticket/25532
+  ntl = nixpkgs.ntl.overrideAttrs (oldAttrs: rec {
+    name = "ntl-10.5.0";
+    sourceRoot = "${name}/src";
+    src = fetchurl {
+      url = "http://www.shoup.net/ntl/${name}.tar.gz";
+      sha256 = "1lmldaldgfr2b2a6585m3np5ds8bq1bis2s1ajycjm49vp4kc2xr";
+    };
+  });
+
+  giac = nixpkgs.giac.override { inherit ntl; };
+  arb = nixpkgs.arb.override { inherit flint; };
+
   # update causes issues
   # https://groups.google.com/forum/#!topic/sage-packaging/cS3v05Q0zso
   # https://trac.sagemath.org/ticket/24735
-  singular = nixpkgs.singular.overrideAttrs (oldAttrs: {
+  singular = (nixpkgs.singular.override { inherit ntl flint; }).overrideAttrs (oldAttrs: {
     name = "singular-4.1.0p3";
     src = fetchurl {
       url = "http://www.mathematik.uni-kl.de/ftp/pub/Math/Singular/SOURCES/4-1-0/singular-4.1.0p3.tar.gz";
@@ -131,15 +134,15 @@ let
 
   # *not* to confuse with the python package "pynac"
   # https://trac.sagemath.org/ticket/24838 (depends on arb update)
-  pynac = nixpkgs.pynac.override { inherit singular; };
+  pynac = nixpkgs.pynac.override { inherit singular flint; };
 
-  eclib = nixpkgs.eclib.override { inherit pari; };
+  eclib = nixpkgs.eclib.override { inherit pari ntl; };
 
   # With openblas (64 bit), the tests fail the same way as when sage is build with
   # openblas instead of openblasCompat. Apparently other packages somehow use flints
   # blas when it is available. Alternative would be to override flint to use
   # openblasCompat.
-  flint = nixpkgs.flint.override { withBlas = false; };
+  flint = nixpkgs.flint.override { withBlas = false; inherit ntl; };
 
   # Multiple palp dimensions need to be available and sage expects them all to be
   # in the same folder.
diff --git a/pkgs/applications/science/math/sage/patches/eclib-20180710.patch b/pkgs/applications/science/math/sage/patches/eclib-20180710.patch
new file mode 100644
index 000000000000..d06e1e6cedf2
--- /dev/null
+++ b/pkgs/applications/science/math/sage/patches/eclib-20180710.patch
@@ -0,0 +1,40 @@
+diff --git a/src/sage/interfaces/mwrank.py b/src/sage/interfaces/mwrank.py
+index 4417b59276..ae57ca2991 100644
+--- a/src/sage/interfaces/mwrank.py
++++ b/src/sage/interfaces/mwrank.py
+@@ -54,8 +54,9 @@ def Mwrank(options="", server=None, server_tmpdir=None):
+         sage: M = Mwrank('-v 0 -l')
+         sage: print(M('0 0 1 -1 0'))
+         Curve [0,0,1,-1,0] :    Rank = 1
+-        Generator 1 is [0:-1:1]; height 0.0511114082399688
+-        Regulator = 0.0511114082399688
++        Generator 1 is [0:-1:1]; height 0.051111408239969
++        Regulator = 0.051111408239969
++
+     """
+     global instances
+     try:
+diff --git a/src/sage/libs/eclib/wrap.cpp b/src/sage/libs/eclib/wrap.cpp
+index 5fd5693b53..d12468faa8 100644
+--- a/src/sage/libs/eclib/wrap.cpp
++++ b/src/sage/libs/eclib/wrap.cpp
+@@ -133,8 +133,8 @@ char* Curvedata_isogeny_class(struct Curvedata* E, int verbose)
+ 
+ 
+ int mw_process(struct Curvedata* curve, struct mw* m,
+-                      const struct bigint* x, const struct bigint* y,
+-                      const struct bigint* z, int sat)
++                      const bigint* x, const bigint* y,
++                      const bigint* z, int sat)
+ {
+   Point P(*curve, *x, *y, *z);
+   if (!P.isvalid())
+@@ -188,7 +188,7 @@ int mw_rank(struct mw* m)
+ }
+ 
+ /* Returns index and unsat long array, which user must deallocate */
+-int mw_saturate(struct mw* m, struct bigint* index, char** unsat,
++int mw_saturate(struct mw* m, bigint* index, char** unsat,
+                        long sat_bd, int odd_primes_only)
+ {
+   vector<long> v;
diff --git a/pkgs/applications/science/math/sage/patches/revert-269c1e1551285.patch b/pkgs/applications/science/math/sage/patches/revert-269c1e1551285.patch
deleted file mode 100644
index b57e48b86dec..000000000000
--- a/pkgs/applications/science/math/sage/patches/revert-269c1e1551285.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-reverted:
---- b/src/sage/geometry/polyhedron/backend_cdd.py
-+++ a/src/sage/geometry/polyhedron/backend_cdd.py
-@@ -154,7 +154,9 @@
-             ...    [0.62, -1.38, 0.38],[0.144, -1.04, 0.04],
-             ...    [0.1309090909, -1.0290909091, 0.04]]
-             sage: Polyhedron(point_list)
-+            Traceback (most recent call last):
-+            ...
-+            ValueError: *Error: Numerical inconsistency is found.  Use the GMP exact arithmetic.
--            A 3-dimensional polyhedron in RDF^3 defined as the convex hull of 14 vertices
-             sage: Polyhedron(point_list, base_ring=QQ)
-             A 3-dimensional polyhedron in QQ^3 defined as the convex hull of 14 vertices
-         """
diff --git a/pkgs/applications/science/math/sage/sage-src.nix b/pkgs/applications/science/math/sage/sage-src.nix
index 2eb7f8100597..c97785c574cb 100644
--- a/pkgs/applications/science/math/sage/sage-src.nix
+++ b/pkgs/applications/science/math/sage/sage-src.nix
@@ -84,6 +84,12 @@ stdenv.mkDerivation rec {
   ];
 
   packageUpgradePatches = [
+    (fetchpatch {
+      name = "cypari2-1.2.1.patch";
+      url = "https://git.sagemath.org/sage.git/patch/?h=62fe6eb15111327d930336d4252d5b23cbb22ab9";
+      sha256 = "1xax7vvs8h4xip16xcsp47xdb6lig6f2r3pl8cksvlz8lhgbyxh2";
+    })
+
     # matplotlib 2.2.2 deprecated `normed` (replaced by `density`).
     # This patch only ignores the warning. It would be equally easy to fix it
     # (by replacing all mentions of `normed` by `density`), but its better to
@@ -150,7 +156,12 @@ stdenv.mkDerivation rec {
       sha256 = "0fmw7pzbaxs2dshky6iw9pr8i23p9ih2y2lw661qypdrxh5xw03k";
       stripLen = 1;
     })
-    ./patches/revert-269c1e1551285.patch
+    (fetchpatch {
+      name = "revert-cddlib-doctest-changes.patch";
+      url = "https://git.sagemath.org/sage.git/patch/?id=269c1e1551285566b8ba7a2b890989e5590e9f11";
+      sha256 = "12bcjhq7hm2pmmj2bgjvcffjyls2x7q61ivlnaj5v5bsvhc183iy";
+      revert = true;
+    })
 
 
     # Only formatting changes.
@@ -170,6 +181,9 @@ stdenv.mkDerivation rec {
 
     # https://trac.sagemath.org/ticket/24838 rebased
     ./patches/pynac-0.7.22.patch
+
+    # https://trac.sagemath.org/ticket/25862
+    ./patches/eclib-20180710.patch
   ];
 
   patches = nixPatches ++ packageUpgradePatches;
diff --git a/pkgs/applications/science/math/sage/sagenb.nix b/pkgs/applications/science/math/sage/sagenb.nix
index 5ab387ebc5e1..cc883cc24b42 100644
--- a/pkgs/applications/science/math/sage/sagenb.nix
+++ b/pkgs/applications/science/math/sage/sagenb.nix
@@ -36,6 +36,14 @@ buildPythonPackage rec {
   # tests depend on sage
   doCheck = false;
 
+  patches = [
+    # work with latest flask-babel
+    (fetchpatch {
+      url = "https://github.com/sagemath/sagenb/commit/ba065eca63dd34a383e4c7ba7561430a90fcd087.patch";
+      sha256 = "1lamzsrgymdd618imrasjp6ivhw2aynh83gkybsd7pm1rzjcq4x8";
+    })
+  ];
+
   meta = with stdenv.lib; {
     description = "Sage Notebook";
     license = licenses.gpl3Plus;