* gnu/packages/sagemath.scm (ecl-16): New variable.
* gnu/packages/patches/ecl-16-format-directive-limit.patch,
gnu/packages/patches/ecl-16-ignore-stderr-write-error.patch,
gnu/packages/patches/ecl-16-libffi.patch: New files.
* gnu/local.mk (dist_patch_DATA): Register the patches.
.../ecl-16-format-directive-limit.patch | 83 +++++++++++++++++++
.../ecl-16-ignore-stderr-write-error.patch | 17 ++++
gnu/packages/patches/ecl-16-libffi.patch | 16 ++++
gnu/packages/sagemath.scm | 23 +++++
5 files changed, 142 insertions(+)
create mode 100644 gnu/packages/patches/ecl-16-format-directive-limit.patch
create mode 100644 gnu/packages/patches/ecl-16-ignore-stderr-write-error.patch
create mode 100644 gnu/packages/patches/ecl-16-libffi.patch
Toggle diff (198 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 41b92e3830..486e7aa8cc 100644
@@ -881,6 +881,9 @@ dist_patch_DATA = \
%D%/packages/patches/dstat-skip-devices-without-io.patch \
%D%/packages/patches/dune-istl-2.7-fix-non-mpi-tests.patch \
%D%/packages/patches/dvd+rw-tools-add-include.patch \
+ %D%/packages/patches/ecl-16-format-directive-limit.patch \
+ %D%/packages/patches/ecl-16-ignore-stderr-write-error.patch \
+ %D%/packages/patches/ecl-16-libffi.patch \
%D%/packages/patches/eigen-stabilise-sparseqr-test.patch \
%D%/packages/patches/einstein-build.patch \
%D%/packages/patches/elfutils-tests-ptrace.patch \
diff --git a/gnu/packages/patches/ecl-16-format-directive-limit.patch b/gnu/packages/patches/ecl-16-format-directive-limit.patch
index 0000000000..237db92722
+++ b/gnu/packages/patches/ecl-16-format-directive-limit.patch
+Patch backported by Sage.
+Fix from upstream that happens to work around
+https://trac.sagemath.org/ticket/23011
+diff --git a/src/lsp/format.lsp b/src/lsp/format.lsp
+index 77ca799..53b887c 100644
+--- a/src/lsp/format.lsp
++++ b/src/lsp/format.lsp
+ :start (format-directive-start struct)
+ :end (format-directive-end struct))))
++(defconstant +format-directive-limit+ (1+ (char-code #\~)))
+ (defparameter *format-directive-expanders*
+- (make-array char-code-limit :initial-element nil))
++ (make-array +format-directive-limit+ :initial-element nil))
+ (defparameter *format-directive-interpreters*
+- (make-array char-code-limit :initial-element nil))
++ (make-array +format-directive-limit+ :initial-element nil))
+ (defparameter *default-format-error-control-string* nil)
+ (defparameter *default-format-error-offset* nil)
+ (write-string directive stream)
+ (interpret-directive-list stream (cdr directives) orig-args args))
+ (#-ecl format-directive #+ecl vector
++ (new-directives new-args)
++ (let* ((code (char-code (format-directive-character directive)))
++ (and (< code +format-directive-limit+)
++ (svref *format-directive-interpreters* code)))
++ (*default-format-error-offset*
++ (1- (format-directive-end directive))))
++ :complaint "Unknown format directive."))
+ (new-directives new-args)
+- (svref *format-directive-interpreters*
+- (char-code (format-directive-character
+- (*default-format-error-offset*
+- (1- (format-directive-end directive))))
+- :complaint "Unknown format directive."))
+- (new-directives new-args)
+- (funcall function stream directive
+- (cdr directives) orig-args args)
+- (values new-directives new-args)))
+- (interpret-directive-list stream new-directives
+- orig-args new-args)))))
++ (funcall function stream directive
++ (cdr directives) orig-args args)
++ (values new-directives new-args)))
++ (interpret-directive-list stream new-directives
++ orig-args new-args)))))
+ (values `(write-string ,directive stream)
+- (aref *format-directive-expanders*
+- (char-code (format-directive-character directive))))
+- (*default-format-error-offset*
+- (1- (format-directive-end directive))))
++ (let* ((code (char-code (format-directive-character directive)))
++ (and (< code +format-directive-limit+)
++ (svref *format-directive-expanders* code)))
++ (*default-format-error-offset*
++ (1- (format-directive-end directive))))
+ (funcall expander directive more-directives)
diff --git a/gnu/packages/patches/ecl-16-ignore-stderr-write-error.patch b/gnu/packages/patches/ecl-16-ignore-stderr-write-error.patch
index 0000000000..42d213c0e9
+++ b/gnu/packages/patches/ecl-16-ignore-stderr-write-error.patch
+Patch adapted from Sage.
+diff -Naur ecl-16.1.2.orig/src/c/file.d ecl-16.1.2/src/c/file.d
+--- ecl-16.1.2.orig/src/c/file.d 2016-05-11 13:10:51.867673867 +1200
++++ ecl-16.1.2/src/c/file.d 2016-05-11 14:44:48.121907307 +1200
+ ecl_disable_interrupts();
+ out = fwrite(c, sizeof(char), n, IO_STREAM_FILE(strm));
+- } while (out < n && restartable_io_error(strm, "fwrite"));
+- ecl_enable_interrupts();
++ /* Ignore write errors to stderr to avoid an infinite loop */
++ } while (out < n && (IO_STREAM_FILE(strm) != stderr) && restartable_io_error(strm, "fwrite"));
++ ecl_enable_interrupts();
diff --git a/gnu/packages/patches/ecl-16-libffi.patch b/gnu/packages/patches/ecl-16-libffi.patch
index 0000000000..fc06a07606
+++ b/gnu/packages/patches/ecl-16-libffi.patch
+Patch adapted from Sage. Allows building ECL on libffi 3.3.
+diff --git a/src/c/ffi.d b/src/c/ffi.d
+index 8861303e..8a959c23 100644
+@@ -133,8 +133,8 @@ static struct {
+ #elif defined(X86_WIN64)
+ {@':win64', FFI_WIN64},
+ #elif defined(X86_ANY) || defined(X86) || defined(X86_64)
+- {@':cdecl', FFI_SYSV},
++ {@':cdecl', FFI_UNIX64},
++ {@':sysv', FFI_UNIX64},
+ {@':unix64', FFI_UNIX64},
diff --git a/gnu/packages/sagemath.scm b/gnu/packages/sagemath.scm
index 34fe9e524c..c94020f13e 100644
--- a/gnu/packages/sagemath.scm
+++ b/gnu/packages/sagemath.scm
;;; Copyright © 2019 Andreas Enge <andreas@enge.fr>
;;; Copyright © 2019 Nicolas Goaziou <mail@nicolasgoaziou.fr>
;;; Copyright © 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
;;; This file is part of GNU Guix.
#:use-module (gnu packages boost)
#:use-module (gnu packages compression)
#:use-module (gnu packages image)
+ #:use-module (gnu packages lisp)
#:use-module (gnu packages multiprecision)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages python)
@@ -184,6 +186,27 @@ represented as strings.")
(license license:public-domain)
(home-page "https://github.com/miguelmarco/libhomfly")))
+;; Sage 9.1 doesn't build with ECL 20. This won't be necessary once 9.2 is
+;; released. See https://trac.sagemath.org/ticket/22191
+ "https://common-lisp.net/project/ecl/static/files/release/ecl"
+ (base32 "0m0j24w5d5a9dwwqyrg0d35c0nys16ijb4r0nyk87yp82v38b9bn"))
+ (patches (search-patches
+ "ecl-16-ignore-stderr-write-error.patch"
+ "ecl-16-format-directive-limit.patch"))))
+ ;; Current ECL uses LGPL 2.1+
+ (license license:lgpl2.0+)))