diff mbox series

[bug#56729,RFC,10/10] gnu: Add sagemath.

Message ID 8b34d84b936a6f6d94479116e15bd5dfa2cd2cdb.1658595756.git.guix@ikherbers.com
State New
Headers show
Series Add sagemath. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git-branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue
cbaines/comparison success View comparision
cbaines/git-branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue
cbaines/comparison success View comparision
cbaines/git-branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue
cbaines/comparison success View comparision
cbaines/git-branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue
cbaines/comparison success View comparision
cbaines/git-branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue
cbaines/comparison success View comparision
cbaines/git-branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue
cbaines/comparison success View comparision
cbaines/git-branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue
cbaines/comparison success View comparision
cbaines/git-branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

vicvbcun July 23, 2022, 8:52 p.m. UTC
* gnu/packages/sagemath.scm (sagemath): New variable.
---

Notes:
- I'm not sure about native inputs vs. inputs here.
- There is a broken symlink in share/jupyter/kernels/sagemath/doc is
  currently a broken symlink. We should probably remove it and add it
  into the documentation output.
- bin/ is currently full of random stuff, we probably only need a few
  things.

 gnu/packages/sagemath.scm | 106 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 106 insertions(+)
diff mbox series

Patch

diff --git a/gnu/packages/sagemath.scm b/gnu/packages/sagemath.scm
index 335d98d9f4..f84440db93 100644
--- a/gnu/packages/sagemath.scm
+++ b/gnu/packages/sagemath.scm
@@ -4,6 +4,7 @@ 
 ;;; Copyright © 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
 ;;; Copyright © 2021 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2022 vicvbcun <guix@ikherbers.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -25,6 +26,7 @@  (define-module (gnu packages sagemath)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system python)
   #:use-module (guix download)
+  #:use-module (guix gexp)
   #:use-module (guix git-download)
   #:use-module (guix packages)
   #:use-module (guix utils)
@@ -34,6 +36,8 @@  (define-module (gnu packages sagemath)
   #:use-module (gnu packages bdw-gc)
   #:use-module (gnu packages boost)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages gd)
+  #:use-module (gnu packages graph)
   #:use-module (gnu packages image)
   #:use-module (gnu packages lisp)
   #:use-module (gnu packages maths)
@@ -41,6 +45,7 @@  (define-module (gnu packages sagemath)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages popt)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages python-build)
   #:use-module (gnu packages python-xyz))
 
 
@@ -400,3 +405,104 @@  (define-public python-pplpy
      "This Python module pplpy provides a wrapper to the C++ Parma Polyhedra
 Library (PPL).")
     (license license:gpl3)))
+
+(define-public sagemath
+  (package
+    (name "sagemath")
+    (version "9.6")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/sagemath/sage")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "0k91l3aid09hy94ps2r6acg22bxgsprxnh1b92hma3z1mn0ii3s1"))))
+    (build-system python-build-system)
+    (arguments
+     (list #:tests? #f                  ; may take a long time, I'm scared
+           #:use-setuptools? #f
+           #:phases #~(modify-phases %standard-phases
+                        (add-after 'unpack 'prepare-build
+                          (lambda _
+                            (setenv "SAGE_NUM_THREADS"
+                                    (number->string (parallel-job-count)))
+                            (setenv "SAGE_VENV" #$output)
+                            (chdir "src")))
+                        (add-after 'install 'fix-logo-symlinks
+                          ;; these symlinks point to /tmp/guix-build-... so we
+                          ;; need to recreate them
+                          (lambda _
+                            (for-each
+                             (lambda (file)
+                               (let
+                                   ((source (string-append "sage/ext_data/notebook-ipython/" file))
+                                    (target (string-append #$output "/share/jupyter/kernels/sagemath/" file)))
+                                 (delete-file target)
+                                 (copy-file source target)))
+                             '("logo.svg" "logo-64x64.png"))))
+                        (add-after 'install 'delete-nbextensions
+                          ;; broken symlink to threejs-sage which we
+                          ;; don't even package
+                          (lambda _
+                            (delete-file-recursively (string-append #$output "/share/jupyter/nbextensions"))))
+                        (add-after 'install 'install-bin
+                          ;; so far, we have only installed the
+                          ;; library part of sage
+                          (lambda _
+                            ;; this copies way to much
+                            (copy-recursively "bin" (string-append #$output "/bin")))))))
+    (inputs (list arb
+                  boost
+                  brial
+                  cliquer
+                  ecl
+                  eclib
+                  edge-addition-planarity-suite
+                  flint
+                  gap
+                  gd
+                  giac
+                  givaro
+                  glpk
+                  gmp
+                  gmp-ecm
+                  gsl
+                  iml
+                  lcalc
+                  libbraiding
+                  libhomfly
+                  linbox
+                  m4ri
+                  m4rie
+                  mpc
+                  mpfi
+                  ntl
+                  openblas
+                  pari-gp
+                  python-cypari2
+                  python-gmpy2
+                  python-jinja2
+                  python-jupyter-core
+                  python-memory-allocator
+                  python-numpy
+                  python-pkgconfig
+                  python-pplpy
+                  python-setuptools
+                  python-wheel
+                  rw
+                  singular
+                  symmetrica
+                  zlib
+                  zn-poly))
+    (native-inputs (list pkg-config python-cython))
+    (home-page "https://www.sagemath.org")
+    (synopsis "Python-based computer algebra system")
+    (description
+     "SageMath is a free open-source mathematics software system licensed under the
+GPL. It builds on top of many existing open-source packages: NumPy, SciPy,
+matplotlib, Sympy, Maxima, GAP, FLINT, R and many more. Access their combined
+power through a common, Python-based language or directly via interfaces or
+wrappers.")
+    (license license:gpl3)))