diff --git a/pkgs/applications/science/math/sage/patches/gap-element-crash.patch b/pkgs/applications/science/math/sage/patches/gap-element-crash.patch new file mode 100644 index 000000000000..b5396e2b7854 --- /dev/null +++ b/pkgs/applications/science/math/sage/patches/gap-element-crash.patch @@ -0,0 +1,18 @@ +diff --git a/src/sage/libs/gap/element.pyx b/src/sage/libs/gap/element.pyx +index b2b0681c052..b2e5807392c 100644 +--- a/src/sage/libs/gap/element.pyx ++++ b/src/sage/libs/gap/element.pyx +@@ -35,6 +35,13 @@ from sage.structure.coerce cimport coercion_model as cm + ### helper functions to construct lists and records ######################## + ############################################################################ + ++ ++cdef extern from *: ++ """ ++ #pragma GCC optimize("O1") ++ """ ++ ++ + cdef Obj make_gap_list(sage_list) except NULL: + """ + Convert Sage lists into Gap lists diff --git a/pkgs/applications/science/math/sage/sage-env.nix b/pkgs/applications/science/math/sage/sage-env.nix index f95e08c51ff4..e886f6645468 100644 --- a/pkgs/applications/science/math/sage/sage-env.nix +++ b/pkgs/applications/science/math/sage/sage-env.nix @@ -5,6 +5,7 @@ , sage-docbuild , env-locations , gfortran +, ninja , bash , coreutils , gnused @@ -63,6 +64,7 @@ let "@sage-local@/build" pythonEnv gfortran # for inline fortran + ninja # for inline fortran via numpy.f2py stdenv.cc # for cython bash coreutils diff --git a/pkgs/applications/science/math/sage/sage-src.nix b/pkgs/applications/science/math/sage/sage-src.nix index de0c2e3b1e20..b21bb07e6a64 100644 --- a/pkgs/applications/science/math/sage/sage-src.nix +++ b/pkgs/applications/science/math/sage/sage-src.nix @@ -61,19 +61,9 @@ stdenv.mkDerivation rec { hash = "sha256-uCXchYx26DdxTjR1k2748KCEHPnekKS2fAM7SpyhNvM="; }) - # https://github.com/sagemath/sage/pull/37763, landed in 10.4.beta2 - (fetchpatch { - name = "scipy-fault-tolerance.patch"; - url = "https://github.com/sagemath/sage/commit/551139c09f26a5da96b1187c3f0dd17b8d80ef84.diff"; - hash = "sha256-PR4przrZ3ieHaW2nSY7l7VhNfrUupu9yCIrXpeyoAgg="; - }) - - # first two commits from https://github.com/sagemath/sage/pull/38100 - (fetchpatch { - name = "sphinx-7.3-update.patch"; - url = "https://github.com/sagemath/sage/compare/10.4.beta7...d2932e142991b442a3eee5dc4f8949e3f7e6fe5c.patch"; - hash = "sha256-g6w0ImE0d2ocKnbGMQikcz9eI9r3/gESlA1NrQfGimk="; - }) + # compile libs/gap/element.pyx with -O1 + # a more conservative version of https://github.com/sagemath/sage/pull/37951 + ./patches/gap-element-crash.patch ]; # Patches needed because of package updates. We could just pin the versions of @@ -83,12 +73,40 @@ stdenv.mkDerivation rec { # should come from or be proposed to upstream. This list will probably never # be empty since dependencies update all the time. packageUpgradePatches = [ - # https://github.com/sagemath/sage/pull/37492 + # https://github.com/sagemath/sage/pull/37763, landed in 10.4.beta2 + (fetchpatch { + name = "scipy-fault-tolerance.patch"; + url = "https://github.com/sagemath/sage/commit/551139c09f26a5da96b1187c3f0dd17b8d80ef84.diff"; + hash = "sha256-PR4przrZ3ieHaW2nSY7l7VhNfrUupu9yCIrXpeyoAgg="; + }) + + # https://github.com/sagemath/sage/pull/37492, landed in 10.4.beta5 (fetchpatch { name = "singular-4.3.2p14-upgrade.patch"; url = "https://github.com/sagemath/sage/commit/a0c56816b051e97da44ac0a4e4d4f6915cf7fa0f.diff"; sha256 = "sha256-WGMmPeBoj2LUC+2qxWuaJL89QUuGt6axGvxWkpM9LYg="; }) + + # https://github.com/sagemath/sage/pull/37949, landed in 10.4.beta6 + (fetchpatch { + name = "conway-polynomials-new-len.patch"; + url = "https://github.com/sagemath/sage/commit/c9f5b45179e92ea0de1e0dbe0f47464010902851.diff"; + hash = "sha256-DwN2UIX8dxfxjIiqVvMdGbIxJ7CR/Ag2XUmS5vUKFTs="; + }) + + # https://github.com/sagemath/sage/pull/37967, landed in 10.4.beta6 + (fetchpatch { + name = "conway-polynomials-ell-point.patch"; + url = "https://github.com/sagemath/sage/commit/4e0bbaf90262a42f8ea14d5bcfed65f9d1787f54.diff"; + hash = "sha256-9gXydi1A+n7+K8YpH0PB8l/OMexhgO2F5NccU0cK+ls="; + }) + + # https://github.com/sagemath/sage/pull/38100, landed in 10.4.beta8 + (fetchpatch { + name = "sphinx-7.3-update.patch"; + url = "https://github.com/sagemath/sage/commit/e1b22690db42885423be5049246eb71ff52bdfef.diff"; + hash = "sha256-04KAyz8+0pJbRV8Ld0bNX1OoEx/35gIh3Nff+6n8QUU="; + }) ]; patches = nixPatches ++ bugfixPatches ++ packageUpgradePatches; diff --git a/pkgs/applications/science/math/sage/sagelib.nix b/pkgs/applications/science/math/sage/sagelib.nix index f54c6a92300c..1a138eea81d9 100644 --- a/pkgs/applications/science/math/sage/sagelib.nix +++ b/pkgs/applications/science/math/sage/sagelib.nix @@ -6,6 +6,7 @@ , perl , pkg-config , sage-setup +, setuptools , gd , iml , libpng @@ -62,6 +63,7 @@ , lrcalc-python , matplotlib , memory-allocator +, meson-python , mpmath , networkx , numpy @@ -78,7 +80,6 @@ , sphinx , sympy , typing-extensions -, nbclassic }: assert (!blas.isILP64) && (!lapack.isILP64); @@ -102,6 +103,7 @@ buildPythonPackage rec { pip # needed to query installed packages pkg-config sage-setup + setuptools ]; pythonRelaxDeps = [ @@ -171,6 +173,7 @@ buildPythonPackage rec { lrcalc-python matplotlib memory-allocator + meson-python mpmath networkx numpy @@ -187,8 +190,6 @@ buildPythonPackage rec { sphinx sympy typing-extensions - - nbclassic ]; preBuild = ''