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/giac/default.nix28
-rw-r--r--pkgs/applications/science/math/sage/patches/docutils-0.18.1-deprecation.patch13
-rw-r--r--pkgs/applications/science/math/sage/sage-src.nix38
3 files changed, 56 insertions, 23 deletions
diff --git a/pkgs/applications/science/math/giac/default.nix b/pkgs/applications/science/math/giac/default.nix
index 4700402ff21..d684865432d 100644
--- a/pkgs/applications/science/math/giac/default.nix
+++ b/pkgs/applications/science/math/giac/default.nix
@@ -1,6 +1,6 @@
 { stdenv, lib, fetchurl, fetchpatch, texlive, bison, flex, lapack, blas
-, gmp, mpfr, pari, ntl, gsl, mpfi, ecm, glpk, nauty
-, readline, gettext, libpng, libao, gfortran, perl
+, autoreconfHook, gmp, mpfr, pari, ntl, gsl, mpfi, ecm, glpk, nauty
+, buildPackages, readline, gettext, libpng, libao, gfortran, perl
 , enableGUI ? false, libGL, libGLU, xorg, fltk
 , enableMicroPy ? false, python3
 }:
@@ -9,11 +9,11 @@ assert (!blas.isILP64) && (!lapack.isILP64);
 
 stdenv.mkDerivation rec {
   pname = "giac${lib.optionalString enableGUI "-with-xcas"}";
-  version = "1.6.0-47"; # TODO try to remove preCheck phase on upgrade
+  version = "1.9.0-5"; # TODO try to remove preCheck phase on upgrade
 
   src = fetchurl {
     url = "https://www-fourier.ujf-grenoble.fr/~parisse/debian/dists/stable/main/source/giac_${version}.tar.gz";
-    sha256 = "sha256-c5A9/I6L/o3Y3dxEPoTKpw/fJqYMr6euLldaQ1HWT5c=";
+    sha256 = "sha256-EP8wRi8QZPrr1lfKN6da87s1FCy8AuDYbzcvsJCWyLE=";
   };
 
   patches = [
@@ -32,18 +32,21 @@ stdenv.mkDerivation rec {
     })
   ];
 
+  # 1.9.0-5's tarball contains a binary (src/mkjs) which is executed
+  # at build time. we will delete and rebuild it.
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
+
   postPatch = ''
     for i in doc/*/Makefile* micropython*/xcas/Makefile*; do
       substituteInPlace "$i" --replace "/bin/cp" "cp";
     done;
-  '' +
-  # workaround for 1.6.0-47, should not be necessary in future versions
-  lib.optionalString (!enableMicroPy) ''
-    sed -i -e 's/micropython-[0-9.]* //' Makefile*
+    rm src/mkjs
+    substituteInPlace src/Makefile.am --replace "g++ mkjs.cc" \
+      "${buildPackages.stdenv.cc.targetPrefix}c++ mkjs.cc"
   '';
 
   nativeBuildInputs = [
-    texlive.combined.scheme-small bison flex
+    autoreconfHook texlive.combined.scheme-small bison flex
   ];
 
   # perl is only needed for patchShebangs fixup.
@@ -58,13 +61,6 @@ stdenv.mkDerivation rec {
     libGL libGLU fltk xorg.libX11
   ] ++ lib.optional enableMicroPy python3;
 
-  /* fixes:
-  configure:16211: checking for main in -lntl
-  configure:16230: g++ -o conftest -g -O2   conftest.cpp -lntl  -llapack -lblas -lgfortran -ldl -lpng16 -lm -lmpfi -lmpfr -lgmp  >&5
-  /nix/store/y9c1v4x7y39j2rfbg17agjwqdzxpsn18-ntl-11.3.2/lib/libntl.so: undefined reference to `pthread_key_create'
-  */
-  NIX_CFLAGS_LINK="-lpthread";
-
   # xcas Phys and Turtle menus are broken with split outputs
   # and interactive use is likely to need docs
   outputs = [ "out" ] ++ lib.optional (!enableGUI) "doc";
diff --git a/pkgs/applications/science/math/sage/patches/docutils-0.18.1-deprecation.patch b/pkgs/applications/science/math/sage/patches/docutils-0.18.1-deprecation.patch
new file mode 100644
index 00000000000..94e0488e21e
--- /dev/null
+++ b/pkgs/applications/science/math/sage/patches/docutils-0.18.1-deprecation.patch
@@ -0,0 +1,13 @@
+diff --git a/src/sage/misc/sagedoc.py b/src/sage/misc/sagedoc.py
+index 4c56aea078..e51a77ae8a 100644
+--- a/src/sage/misc/sagedoc.py
++++ b/src/sage/misc/sagedoc.py
+@@ -1402,6 +1402,8 @@ class _sage_doc:
+             sage: identity_matrix.__doc__ in browse_sage_doc(identity_matrix, 'rst')
+             True
+             sage: browse_sage_doc(identity_matrix, 'html', False)             # optional - sphinx
++            ...
++            FutureWarning: The configuration setting "embed_images" will be removed in Docutils 1.2. Use "image_loading: link".
+             '...div...File:...Type:...Definition:...identity_matrix...'
+ 
+         In the 'text' version, double colons have been replaced with
diff --git a/pkgs/applications/science/math/sage/sage-src.nix b/pkgs/applications/science/math/sage/sage-src.nix
index 04c2355d26a..b230b0d42a0 100644
--- a/pkgs/applications/science/math/sage/sage-src.nix
+++ b/pkgs/applications/science/math/sage/sage-src.nix
@@ -13,9 +13,14 @@ let
   # Fetch a diff between `base` and `rev` on sage's git server.
   # Used to fetch trac tickets by setting the `base` to the last release and the
   # `rev` to the last commit of the ticket.
-  fetchSageDiff = { base, name, rev, sha256, squashed ? false, ...}@args: (
+  #
+  # We don't use sage's own build system (which builds all its
+  # dependencies), so we exclude changes to "build/" from patches by
+  # default to avoid conflicts.
+  fetchSageDiff = { base, name, rev, sha256, squashed ? false, excludes ? [ "build/*" ]
+                  , ...}@args: (
     fetchpatch ({
-      inherit name sha256;
+      inherit name sha256 excludes;
 
       # There are three places to get changes from:
       #
@@ -49,11 +54,7 @@ let
                "https://github.com/sagemath/sagetrac-mirror/compare/${base}...${rev}.diff"
              ]
              else [ "https://git.sagemath.org/sage.git/patch?id2=${base}&id=${rev}" ];
-
-      # We don't care about sage's own build system (which builds all its dependencies).
-      # Exclude build system changes to avoid conflicts.
-      excludes = [ "build/*" ];
-    } // builtins.removeAttrs args [ "rev" "base" "sha256" "squashed" ])
+    } // builtins.removeAttrs args [ "rev" "base" "sha256" "squashed" "excludes" ])
   );
 in
 stdenv.mkDerivation rec {
@@ -172,6 +173,29 @@ stdenv.mkDerivation rec {
       rev = "8452003846a7303100847d8d0ed642fc642c11d6";
       sha256 = "sha256-A/XMouPlc2sjFp30L+56fBGJXydS2EtzfPOV98FCDqI=";
     })
+
+    # https://trac.sagemath.org/ticket/33226
+    (fetchSageDiff {
+      base = "9.6.beta0";
+      name = "giac-1.7.0-45-update.patch";
+      rev = "33ea2adf01e9e2ce9f1e33779f0b1ac0d9d1989c";
+      sha256 = "sha256-DOyxahf3+IaYdkgmAReNDCorRzMgO8+yiVrJ5TW1km0=";
+    })
+
+    # https://trac.sagemath.org/ticket/33398
+    (fetchSageDiff {
+      base = "9.6.beta4";
+      name = "sympy-1.10-update.patch";
+      rev = "6b7c3a28656180e42163dc10f7b4a571b93e5f27";
+      sha256 = "sha256-fnUyM2yjHkCykKRfzQQ4glcUYmCS/fYzDzmCf0nuebk=";
+      # The patch contains a whitespace change to a file that didn't exist in Sage 9.5.
+      excludes = [ "build/*" "src/sage/manifolds/vector_bundle_fiber_element.py" ];
+    })
+
+    # docutils 0.18.1 now triggers Sphinx warnings. tolerate them for
+    # now, because patching Sphinx is not feasible.
+    # https://github.com/sphinx-doc/sphinx/issues/9777#issuecomment-1104481271
+    ./patches/docutils-0.18.1-deprecation.patch
   ];
 
   patches = nixPatches ++ bugfixPatches ++ packageUpgradePatches;