Subject: [PATCH 5/5] [WIP] gnu: Add sagemath.

From: Jakub Kądziołka <[email-masked]>
Date: Sat, 20 Jun 2020 23:32:18 +0200

---
 gnu/packages/sagemath.scm | 123 +++++++++++++++++++++++++++++++++++++-
 1 file changed, 122 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/sagemath.scm b/gnu/packages/sagemath.scm
index 8c837fdaeb..9809f93060 100644
--- a/gnu/packages/sagemath.scm
+++ b/gnu/packages/sagemath.scm
@@ -29,16 +29,33 @@
   #:use-module (guix utils)
   #:use-module (gnu packages)
   #:use-module (gnu packages algebra)
+  #:use-module (gnu packages assembly)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages bdw-gc)
   #:use-module (gnu packages boost)
+  #:use-module (gnu packages cmake)
+  #:use-module (gnu packages commencement)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages gd)
+  #:use-module (gnu packages gettext)
+  #:use-module (gnu packages graph)
   #:use-module (gnu packages image)
+  #:use-module (gnu packages libffi)
   #:use-module (gnu packages lisp)
+  #:use-module (gnu packages m4)
+  #:use-module (gnu packages maths)
   #:use-module (gnu packages multiprecision)
+  #:use-module (gnu packages ncurses)
+  #:use-module (gnu packages networking)
+  #:use-module (gnu packages pcre)
+  #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
-  #:use-module (gnu packages python-xyz))
+  #:use-module (gnu packages python-xyz)
+  #:use-module (gnu packages readline)
+  #:use-module (gnu packages sqlite)
+  #:use-module (gnu packages tex)
+  #:use-module (gnu packages tls))

 (define-public python-cypari2
@@ -432,3 +449,107 @@ zeta function and its twists by quadratic characters.")
 a given height bound on a hyperelliptic curve in a very efficient way,
 by using an optimized quadratic sieve algorithm.")
     (license license:gpl2+)))
+
+(define-public sagemath
+  (package
+    (name "sagemath")
+    (version "9.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+              (url "git://git.sagemath.org/sage.git/")
+              (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "1imlqa5mg7xxp6xbzzjnjjpd8k79vlx48zm0qfj7cd4bi0i809pp"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:use-setuptools? #f
+       #:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'prepare
+           (lambda _
+            (setenv "HOME" "/tmp")
+            (setenv "SAGE_ROOT" (getcwd))
+            (setenv "SAGE_LOCAL" (getcwd))
+            (setenv "SAGE_SHARE" (string-append (getcwd) "/share"))
+            (setenv "SAGE_NUM_THREADS" (number->string (parallel-job-count)))
+            (mkdir-p "var/lib/sage/installed")
+            (chdir "src")
+            #t)))))
+    (propagated-inputs
+     `(("python-cypari2" ,python-cypari2)
+       ("python-cysignals" ,python-cysignals)
+       ("python-cython" ,python-cython)
+       ("python-gmpy2" ,python-gmpy2)
+       ("python-jinja2" ,python-jinja2)
+       ("python-numpy" ,python-numpy)
+       ("python-pkgconfig" ,python-pkgconfig)
+       ("python-six" ,python-six)))
+    (inputs
+     `(("arb" ,arb)
+       ("boost" ,boost) ; TODO: Is this needed?
+       ("braiding" ,libbraiding)
+       ("brial" ,brial)
+       ("bzip2" ,bzip2)
+       ("cliquer" ,cliquer)
+       ("ecl" ,ecl-16)
+       ("eclib" ,eclib)
+       ("ecm" ,gmp-ecm)
+       ("ecm:libatomic-ops" ,libatomic-ops)
+       ("flint" ,flint)
+       ("gf2x" ,gf2x)
+       ("gap" ,gap)
+       ("gc" ,libgc)
+       ("gd" ,gd)
+       ("givaro" ,givaro)
+       ("glpk" ,glpk)
+       ("gmp" ,gmp)
+       ("gsl" ,gsl)
+       ("homfly" ,libhomfly)
+       ("iml" ,iml)
+       ("lcalc" ,lcalc)
+       ("libffi" ,libffi)
+       ("libpng" ,libpng)
+       ("linbox" ,linbox)
+       ("lrcalc" ,lrcalc)
+       ("m4ri" ,m4ri)
+       ("m4rie" ,m4rie)
+       ("mpc" ,mpc)
+       ("mpfi" ,mpfi)
+       ("mpfr" ,mpfr)
+       ("ncurses" ,ncurses)
+       ("ntl" ,ntl)
+       ("openssl" ,openssl)
+       ("pari" ,pari-gp)
+       ("pcre" ,pcre)
+       ("planarity" ,edge-addition-planarity-suite)
+       ("ppl" ,ppl)
+       ("pynac" ,pynac)
+       ("rw" ,rw)
+       ("ratpoints" ,ratpoints)
+       ("readline" ,readline)
+       ("singular" ,singular)
+       ("sqlite" ,sqlite)
+       ("symmetrica" ,symmetrica)
+       ("texlive" ,texlive-tiny)
+       ("zeromq" ,zeromq) ; TODO: Is this needed?
+       ("zlib" ,zlib)
+       ("zn-poly" ,zn-poly)))
+    (native-inputs
+     `(("autoconf" ,autoconf)
+       ("automake" ,automake)
+       ("cmake" ,cmake)
+       ("gettext" ,gettext-minimal)
+       ("gfortran" ,gfortran-toolchain)
+       ("m4" ,m4)
+       ("perl" ,perl)
+       ("pkg-config" ,pkg-config)
+       ("yasm" ,yasm)))
+    (home-page "https://www.sagemath.org/")
+    (synopsis "Python-based computer algebra system")
+    (description "TODO")
+    (license license:gpl3)))
-- 
2.26.2