From: tornaria <tornaria@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] [RFC] maxima: add a subpkg maxima-ecl needed for sagemath
Date: Sat, 11 Dec 2021 19:38:54 +0100 [thread overview]
Message-ID: <20211211183854.Ni_eNoAgcAS8IApiU9G09XGy5mdD3HYnlfI4vtrFUmI@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-34273@inbox.vuxu.org>
[-- Attachment #1: Type: text/plain, Size: 1836 bytes --]
There is an updated pull request by tornaria against master on the void-packages repository
https://github.com/tornaria/void-packages maxima
https://github.com/void-linux/void-packages/pull/34273
[RFC] 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.
#### Testing the changes
- I tested the changes in this PR: **briefly**
To compile sagemath using system maxima, two things are necessary:
- the maxima-ecl package that this PR introduces
- the (yet unmerged) changes for sagemath in https://trac.sagemath.org/ticket/32867
Using both I compiled and doctested sagemath, and it seems to be working ok.
#### RFC
My doubts are:
- where to place the library `maxima.fas` as discussed above
- whether to have a build_option for ecl or just hardcode it as enabled
- whether to split the `maxima-ecl` package or place the two files it contains in the package `maxima` itself
A patch file from https://github.com/void-linux/void-packages/pull/34273.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-maxima-34273.patch --]
[-- Type: text/x-diff, Size: 12508 bytes --]
From f45b1624e717809af92e50bcf099d1ef63b4ce5a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sat, 27 Nov 2021 19:38:48 -0300
Subject: [PATCH 1/2] 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.
---
srcpkgs/maxima-ecl | 1 +
...a43e5234305bd6f1de5909d4ce5d7e1ea864.patch | 24 +++++++++++
.../patches/handle-multiple-ldflags.patch | 43 +++++++++++++++++++
srcpkgs/maxima/patches/matrixexp.patch | 23 ++++++++++
srcpkgs/maxima/template | 34 ++++++++++++---
5 files changed, 120 insertions(+), 5 deletions(-)
create mode 120000 srcpkgs/maxima-ecl
create mode 100644 srcpkgs/maxima/patches/a0d7a43e5234305bd6f1de5909d4ce5d7e1ea864.patch
create mode 100644 srcpkgs/maxima/patches/handle-multiple-ldflags.patch
create mode 100644 srcpkgs/maxima/patches/matrixexp.patch
diff --git a/srcpkgs/maxima-ecl b/srcpkgs/maxima-ecl
new file mode 120000
index 000000000000..b8b0e8240fa4
--- /dev/null
+++ b/srcpkgs/maxima-ecl
@@ -0,0 +1 @@
+maxima
\ No newline at end of file
diff --git a/srcpkgs/maxima/patches/a0d7a43e5234305bd6f1de5909d4ce5d7e1ea864.patch b/srcpkgs/maxima/patches/a0d7a43e5234305bd6f1de5909d4ce5d7e1ea864.patch
new file mode 100644
index 000000000000..e1ac1e5f6086
--- /dev/null
+++ b/srcpkgs/maxima/patches/a0d7a43e5234305bd6f1de5909d4ce5d7e1ea864.patch
@@ -0,0 +1,24 @@
+commit a0d7a43e5234305bd6f1de5909d4ce5d7e1ea864
+Author: Robert Dodier <robert_dodier@users.sourceforge.net>
+Date: Mon Oct 11 22:40:13 2021 -0700
+
+ Apply patch #80: "Build a FASL library, needed by SageMath"
+
+ This modifies maxima.system for ECL only.
+
+diff --git a/src/maxima.system b/src/maxima.system
+index d954bc2b9..525fb778e 100644
+--- a/src/maxima.system
++++ b/src/maxima.system
+@@ -75,6 +75,11 @@
+ ;; Convert dir/foo.fas to dir/foo.o
+ (make-pathname :type "o" :defaults p))
+ files)))
++ (c::build-fasl "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))))
+ (c::build-program "binary-ecl/maxima" :lisp-files obj
+ :ld-flags
+ (let ((x (symbol-value (find-symbol "*AUTOCONF-LD-FLAGS*"
diff --git a/srcpkgs/maxima/patches/handle-multiple-ldflags.patch b/srcpkgs/maxima/patches/handle-multiple-ldflags.patch
new file mode 100644
index 000000000000..799fc15f9185
--- /dev/null
+++ b/srcpkgs/maxima/patches/handle-multiple-ldflags.patch
@@ -0,0 +1,43 @@
+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 ()
diff --git a/srcpkgs/maxima/patches/matrixexp.patch b/srcpkgs/maxima/patches/matrixexp.patch
new file mode 100644
index 000000000000..7cbd9ccac089
--- /dev/null
+++ b/srcpkgs/maxima/patches/matrixexp.patch
@@ -0,0 +1,23 @@
+Description: Fix error in matrix exponentiation
+ This patch was written by SageMath but not yet committed into Maxima releases.
+ However, it is needed for SageMath to work correctly:
+ .
+ https://git.sagemath.org/sage.git/tree/build/pkgs/maxima/patches/matrixexp.patch
+Author: Peter Bruin <P.J.Bruin@math.leidenuniv.nl>
+Bug-Sage: http://trac.sagemath.org/ticket/13973
+Bug: https://sourceforge.net/p/maxima/bugs/2596/
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/share/linearalgebra/matrixexp.lisp
++++ b/share/linearalgebra/matrixexp.lisp
+@@ -138,8 +138,8 @@
+ (print `(ratvars = ,$ratvars gcd = '$gcd algebraic = ,$algebraic))
+ (print `(ratfac = ,$ratfac))
+ (merror "Unable to find the spectrum")))
+-
+- (setq res ($fullratsimp (ncpower (sub (mult z ($ident n)) mat) -1) z))
++
++ (setq res ($fullratsimp ($invert_by_lu (sub (mult z ($ident n)) mat) '$crering) z))
+ (setq m (length sp))
+ (dotimes (i m)
+ (setq zi (nth i sp))
diff --git a/srcpkgs/maxima/template b/srcpkgs/maxima/template
index 3a95e3706447..798b4f9f00de 100644
--- a/srcpkgs/maxima/template
+++ b/srcpkgs/maxima/template
@@ -1,11 +1,11 @@
# Template file for 'maxima'
pkgname=maxima
version=5.45.1
-revision=1
+revision=2
build_style=gnu-configure
-configure_args="$(vopt_enable clisp) $(vopt_enable sbcl sbcl-exec)"
+configure_args="$(vopt_enable clisp) $(vopt_enable sbcl sbcl-exec) $(vopt_enable ecl)"
hostmakedepends="python3 perl emacs texinfo"
-makedepends="$(vopt_if clisp clisp) $(vopt_if sbcl sbcl)"
+makedepends="$(vopt_if clisp clisp) $(vopt_if sbcl sbcl) $(vopt_if ecl ecl)"
depends="$(vopt_if clisp clisp) rlwrap"
checkdepends="gnuplot"
short_desc="Computer Algebra System"
@@ -17,10 +17,11 @@ checksum=fe9016276970bef214a1a244348558644514d7fdfaa4fc8b9d0e87afcbb4e7dc
nostrip=yes
nopie=yes
-build_options="clisp sbcl"
+build_options="clisp sbcl ecl"
desc_option_clisp="Build with CLISP"
desc_option_sbcl="Build with SBCL"
-build_options_default="sbcl"
+desc_option_ecl="Build with ECL"
+build_options_default="sbcl ecl"
vopt_conflict clisp sbcl
post_install() {
@@ -66,3 +67,26 @@ xmaxima_package() {
${PKGDESTDIR}/usr/share/pixmaps/maxima
}
}
+
+subpackages="maxima-src maxima-emacs xmaxima"
+
+if [ "$build_option_ecl" ]; then
+ subpackages+=" maxima-ecl"
+fi
+
+maxima-ecl_package() {
+ short_desc+=" - compiled with ECL"
+ depends="${sourcepkg}-${version}_${revision}"
+ pkg_install() {
+ # this is /usr/lib/ecl-${ecl_version}
+ # ideally we would just place it in /usr/lib/ecl but this
+ # doesn't just work
+ # Maybe we can have the ecl package ship a symlink:
+ # /usr/lib/ecl -> /usr/lib/ecl-${ecl_version}
+ # and have this package just install in /usr/lib/ecl
+ ECLDIR=$(ecl -eval "(princ (SI:GET-LIBRARY-PATHNAME))" -eval "(quit)")
+ vmkdir $ECLDIR
+ vinstall src/binary-ecl/maxima.fas 755 $ECLDIR
+ vmove usr/lib/maxima/${version}/binary-ecl
+ }
+}
From 0a3c0f740fad5726f768df3cd58426b8f977e24d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Fri, 10 Dec 2021 14:01:01 -0300
Subject: [PATCH 2/2] maxima: use a shared lib
---
.../maxima/patches/use-shared-library.patch | 21 ++++++++
srcpkgs/maxima/template | 50 +++++++++++++------
2 files changed, 55 insertions(+), 16 deletions(-)
create mode 100644 srcpkgs/maxima/patches/use-shared-library.patch
diff --git a/srcpkgs/maxima/patches/use-shared-library.patch b/srcpkgs/maxima/patches/use-shared-library.patch
new file mode 100644
index 000000000000..a8f986ac7033
--- /dev/null
+++ b/srcpkgs/maxima/patches/use-shared-library.patch
@@ -0,0 +1,21 @@
+--- a/src/maxima.system 2021-12-02 00:26:23.955984864 -0300
++++ b/src/maxima.system 2021-12-02 00:31:22.299541969 -0300
+@@ -87,13 +87,15 @@
+ (let ((obj (mapcar #'(lambda (p)
+ ;; Convert dir/foo.fas to dir/foo.o
+ (make-pathname :type "o" :defaults p))
+- files)))
+- (c::build-fasl "binary-ecl/maxima" :lisp-files obj
++ files))
++ (lib '("binary-ecl/libmaxima-ecl.so")))
++ (c::build-shared-library "binary-ecl/maxima-ecl" :lisp-files obj)
++ (c::build-fasl "binary-ecl/maxima" :lisp-files lib
+ :ld-flags
+ (let ((x (symbol-value (find-symbol "*AUTOCONF-LD-FLAGS*"
+ (find-package "MAXIMA")))))
+ (if (and x (not (string= x ""))) (split-string x))))
+- (c::build-program "binary-ecl/maxima" :lisp-files obj
++ (c::build-program "binary-ecl/maxima" :lisp-files lib
+ :ld-flags
+ (let ((x (symbol-value (find-symbol "*AUTOCONF-LD-FLAGS*"
+ (find-package "MAXIMA")))))
diff --git a/srcpkgs/maxima/template b/srcpkgs/maxima/template
index 798b4f9f00de..1a4bec0dba18 100644
--- a/srcpkgs/maxima/template
+++ b/srcpkgs/maxima/template
@@ -4,7 +4,7 @@ version=5.45.1
revision=2
build_style=gnu-configure
configure_args="$(vopt_enable clisp) $(vopt_enable sbcl sbcl-exec) $(vopt_enable ecl)"
-hostmakedepends="python3 perl emacs texinfo"
+hostmakedepends="python3 perl emacs texinfo patchelf"
makedepends="$(vopt_if clisp clisp) $(vopt_if sbcl sbcl) $(vopt_if ecl ecl)"
depends="$(vopt_if clisp clisp) rlwrap"
checkdepends="gnuplot"
@@ -24,6 +24,29 @@ desc_option_ecl="Build with ECL"
build_options_default="sbcl ecl"
vopt_conflict clisp sbcl
+post_build() {
+ if [ "$build_option_ecl" ]; then
+ # everything will go in the same directory, use rpath=$ORIGIN
+ patchelf --remove-rpath src/binary-ecl/libmaxima-ecl.so
+ patchelf --set-rpath \$ORIGIN \
+ src/binary-ecl/{maxima,maxima.fas}
+ patchelf \
+ --replace-needed binary-ecl/libmaxima-ecl.so libmaxima-ecl.so \
+ src/binary-ecl/{maxima,maxima.fas}
+ fi
+}
+
+do_check() {
+ if [ "$build_option_ecl" ]; then
+ echo "Check that maxima.fas works"
+ ecl --eval "(require 'maxima \"src/binary-ecl/maxima.fas\")" \
+ --eval "(quit)"
+ fi
+
+ # now run the testsuite
+ make ${makejobs} check
+}
+
post_install() {
vmkdir usr/share/doc
ln -sf ../maxima/${version}/doc ${DESTDIR}/usr/share/doc/maxima
@@ -68,25 +91,20 @@ xmaxima_package() {
}
}
-subpackages="maxima-src maxima-emacs xmaxima"
-
-if [ "$build_option_ecl" ]; then
- subpackages+=" maxima-ecl"
-fi
-
maxima-ecl_package() {
short_desc+=" - compiled with ECL"
depends="${sourcepkg}-${version}_${revision}"
pkg_install() {
- # this is /usr/lib/ecl-${ecl_version}
- # ideally we would just place it in /usr/lib/ecl but this
- # doesn't just work
- # Maybe we can have the ecl package ship a symlink:
- # /usr/lib/ecl -> /usr/lib/ecl-${ecl_version}
- # and have this package just install in /usr/lib/ecl
+ BINARY_ECL=/usr/lib/maxima/${version}/binary-ecl
+ vmove ${BINARY_ECL}
+ vinstall src/binary-ecl/libmaxima-ecl.so 755 ${BINARY_ECL}
+ vinstall src/binary-ecl/maxima.fas 755 ${BINARY_ECL}
+
+ # symlink maxima.fas in ECLDIR
ECLDIR=$(ecl -eval "(princ (SI:GET-LIBRARY-PATHNAME))" -eval "(quit)")
- vmkdir $ECLDIR
- vinstall src/binary-ecl/maxima.fas 755 $ECLDIR
- vmove usr/lib/maxima/${version}/binary-ecl
+ vmkdir ${ECLDIR}
+ ln -sr ${PKGDESTDIR}/${BINARY_ECL}/maxima.fas ${PKGDESTDIR}/${ECLDIR}
}
}
+
+subpackages="maxima-src maxima-emacs xmaxima $(vopt_if ecl maxima-ecl)"
next prev parent reply other threads:[~2021-12-11 18:38 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-27 23:25 [PR PATCH] " tornaria
2021-11-28 12:51 ` tornaria
2021-11-28 13:01 ` tornaria
2021-11-28 20:28 ` dkwo
2021-12-01 21:24 ` knusbaum
2021-12-01 23:02 ` tornaria
2021-12-11 18:38 ` tornaria [this message]
2021-12-11 18:56 ` tornaria
2021-12-13 13:09 ` tornaria
2021-12-21 13:08 ` tornaria
2021-12-21 13:19 ` [PR PATCH] [Merged]: " leahneukirchen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211211183854.Ni_eNoAgcAS8IApiU9G09XGy5mdD3HYnlfI4vtrFUmI@z \
--to=tornaria@users.noreply.github.com \
--cc=ml@inbox.vuxu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).