Subject: [RFC PATCH v2 22/29] gnu: Add sagemath-data-elliptic-curves.

From: vicvbcun <[email-masked]>
Date: Mon, 8 Aug 2022 17:45:57 +0200

* gnu/packages/sagemath.scm (sagemath-data-elliptic-curves): New variable.
---
 gnu/packages/sagemath.scm | 45 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/gnu/packages/sagemath.scm b/gnu/packages/sagemath.scm
index 2d82c9ae2e..d4450d5d46 100644
--- a/gnu/packages/sagemath.scm
+++ b/gnu/packages/sagemath.scm
@@ -643,3 +643,48 @@ (define-public sagemath-data-conway-polynomials
       (description synopsis)
       ;; no idea, Arch claims gpl, debian gpl2+??
       (license #f))))
+
+(define-public sagemath-data-elliptic-curves
+  (let
+      ((install-py-origin
+        (origin
+          (method url-fetch)
+          (uri
+           "https://raw.githubusercontent.com/sagemath/sage/9.6/build/pkgs/elliptic_curves/spkg-install.py")
+          (sha256 (base32
+                   "116g684i6mvs11fvb6fzfsr4fn903axn31vigdyb8bgpf8l4hvc5")))))
+    (package
+      (name "sagemath-data-elliptic-curves")
+      (version "0.8.1")
+      (source (origin
+                (method url-fetch)
+                (uri (string-append
+                      "https://mirrors.mit.edu/sage/spkg/upstream/elliptic_curves/elliptic_curves-"
+                      version ".tar.bz2"))
+                (sha256
+                 (base32
+                  "0l7xh4abw5sb4d37r0ylr3vwb88fpx2zrvfm5ql0c7yrv5q59fjz"))))
+      (build-system trivial-build-system)
+      (arguments
+       (list #:modules '((guix build utils))
+             #:builder #~(begin
+                           (use-modules (guix build utils))
+
+                           (setenv "PATH"
+                                   (string-append #+(file-append bzip2 "/bin")
+                                                  ":"
+                                                  #+(file-append tar "/bin") ":"
+                                                  #+(file-append python "/bin")))
+                           (setenv "SAGE_SHARE" (string-append #$output "/share"))
+                           (setenv "PYTHONPATH" (getcwd))
+
+                           (invoke "tar" "-xvf" #$source)
+                           (symlink (string-append "elliptic_curves-" #$version) "src")
+                           (invoke "python3" (assoc-ref %build-inputs "install-py")))))
+      (inputs `(("install-py" ,install-py-origin)))
+      (home-page "https://johncremona.github.io/ecdata/")
+      (synopsis "Databases of elliptic curves")
+      (description synopsis)
+      ;; no idea, Arch claims gpl, alledgedly is part of
+      ;; https://github.com/JohnCremona/ecdata Artistic 2.0
+      (license #f))))
-- 
2.37.0