void-packages/srcpkgs/maxima/patches/handle-multiple-ldflags.patch
Gonzalo Tornaría ab0d3102b5 maxima: add a subpkg maxima-ecl needed for sagemath
- Added a build option 'ecl' (enabled by default)
 - The ecl binary and library will be in a subpkg maxima-ecl so this
   should not affect current users of maxima
 - new patches:
   - a0d7a43...: build a FASL library for ECL (this is merged upstream)
   - handle-multiple-ldflags.patch: otherwise compilation with multiple
     options in LDFLAGS fails (taken from debian)
   - matrixexp.patch: fixes an error in matrix exponentiation (taken
     from debian, this originates in sagemath)

A weak point is that the library maxima.fas is installed in
/usr/lib/ecl-${ecl_version} which is where ecl looks for them, but this
doesn't seem right.

Maybe an alternative would be to have the ecl package ship a symlink at
/usr/lib/ecl pointing to the versioned directory, then have the
maxima-ecl package place its library in the non-versioned directory.
2021-12-21 14:19:58 +01:00

43 lines
1.6 KiB
Diff

Description: Handle multiple LDFLAGS
Without this patch, building with LDFLAGS containing more than one flag results
in flags being dropped.
Author: Graham Inggs <ginggs@debian.org>
Bug-Debian: http://bugs.debian.org/847925
--- a/src/maxima.system
+++ b/src/maxima.system
@@ -58,6 +58,19 @@
(and (apply #'compile-file file :output-file object-output args)
(c:build-fasl output :lisp-files (list object-output)))))
+(defun split-string (string &key (item #\space) (test #'char=))
+ ;; Splits the string into substrings at spaces.
+ (let ((len (length string))
+ (index 0) result)
+ (dotimes (i len
+ (progn (unless (= index len)
+ (push (subseq string index) result))
+ (reverse result)))
+ (when (funcall test (char string i) item)
+ (unless (= index i);; two spaces in a row
+ (push (subseq string index i) result))
+ (setf index (1+ i))))))
+
#+ecl
(defun build-maxima-lib ()
(labels ((list-all-objects (module)
@@ -79,12 +92,12 @@
:ld-flags
(let ((x (symbol-value (find-symbol "*AUTOCONF-LD-FLAGS*"
(find-package "MAXIMA")))))
- (if (and x (not (string= x ""))) (list x))))
+ (if (and x (not (string= x ""))) (split-string x))))
(c::build-program "binary-ecl/maxima" :lisp-files obj
:ld-flags
(let ((x (symbol-value (find-symbol "*AUTOCONF-LD-FLAGS*"
(find-package "MAXIMA")))))
- (if (and x (not (string= x ""))) (list x)))
+ (if (and x (not (string= x ""))) (split-string x)))
:epilogue-code '(progn (cl-user::run)))))))
(defun maxima-binary-pathname ()