Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F110987628
D24959.id73085.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
13 KB
Referenced Files
None
Subscribers
None
D24959.id73085.diff
View Options
Index: head/math/maxima/Makefile
===================================================================
--- head/math/maxima/Makefile
+++ head/math/maxima/Makefile
@@ -3,7 +3,7 @@
PORTNAME= maxima
PORTVERSION= 5.43.2
-PORTREVISION= 4
+PORTREVISION= 5
CATEGORIES= math lisp tk
MASTER_SITES= SF/maxima/Maxima-source/${PORTVERSION}-source
@@ -19,7 +19,7 @@
RUN_DEPENDS= gnuplot:math/gnuplot \
rlwrap:devel/rlwrap
-USES= autoreconf gmake makeinfo shared-mime-info tk
+USES= autoreconf gmake makeinfo shared-mime-info
GNU_CONFIGURE= yes
CONFIGURE_ARGS= PYTHON=dummy
@@ -31,11 +31,11 @@
PORTDATA= *
PORTEXAMPLES= *
-OPTIONS_DEFINE= EXAMPLES DOCS NOUSERINIT MANPAGES TEST
+OPTIONS_DEFINE= EXAMPLES DOCS NOUSERINIT MANPAGES SAGE TEST XMAXIMA
OPTIONS_SINGLE= LISP
-OPTIONS_SINGLE_LISP= CCL CMUCL SBCL
+OPTIONS_SINGLE_LISP= CCL CMUCL ECL SBCL
-OPTIONS_DEFAULT= NOUSERINIT MANPAGES SBCL
+OPTIONS_DEFAULT= ECL NOUSERINIT MANPAGES SAGE TEST XMAXIMA
OPTIONS_SUB= yes
CCL_DESC= Build with Clozure Common Lisp
@@ -50,17 +50,45 @@
CMUCL_CONFIGURE_ON= --enable-cmucl
CMUCL_PLIST_SUB= BINDIR=binary-cmucl BINNAME=maxima_core
+ECL_DESC= Build with Embedabble Common Lisp
+ECL_BUILD_DEPENDS= ecl:lang/ecl
+ECL_RUN_DEPENDS= ecl:lang/ecl
+ECL_LIB_DEPENDS= libgmp.so:math/gmp \
+ libffi.so:devel/libffi \
+ libgc.so:devel/boehm-gc \
+ libgc-threaded.so:devel/boehm-gc-threaded
+# libgc-threaded.so is really only used when ecl is built with THREADS on,
+# which is the default. See https://reviews.freebsd.org/D24959 for more
+# details.
+ECL_CONFIGURE_ON= --with-ecl=ecl
+ECL_PLIST_SUB= BINDIR=binary-ecl BINNAME=maxima
+GET_ECLLIB= ecl -eval "(princ (SI:GET-LIBRARY-PATHNAME))" -eval "(quit)"
+
NOUSERINIT_DESC= Do not load user init file for lisp (only for sbcl)
+SAGE_DESC= Build with patches from Sage (implies ECL)
+SAGE_EXTRA_PATCHES= ${PATCHDIR}/extra-patch-share_linearalgebra_matrixexp.lisp \
+ ${PATCHDIR}/extra-patch-src_grind.lisp \
+ ${PATCHDIR}/extra-patch-src_hayat.lisp \
+ ${PATCHDIR}/extra-patch-src_init-cl.lisp \
+ ${PATCHDIR}/extra-patch-src_maxima.system
+SAGE_IMPLIES= ECL
+
SBCL_DESC= Build with Steel Bank Common Lisp
SBCL_BUILD_DEPENDS= sbcl:lang/sbcl
SBCL_RUN_DEPENDS= sbcl:lang/sbcl
SBCL_CONFIGURE_ON= --enable-sbcl
SBCL_PLIST_SUB= BINDIR=binary-sbcl BINNAME=maxima_core
-TEST_TARGET= check
+TEST_TARGET= check
TEST_BUILD_DEPENDS= gnuplot:math/gnuplot \
rlwrap:devel/rlwrap
+
+XMAXIMA_DESC= Install xmaxima (implies DOCS and TEST)
+XMAXIMA_IMPLIES= DOCS TEST
+XMAXIMA_USES= tk
+XMAXIMA_CONFIGURE_WITH= wish=${WISH}
+
post-patch:
${GREP} -Fe '.core' -l -r ${WRKSRC} | ${XARGS} ${REINPLACE_CMD} 's;\.core;_core;g'
${FIND} -X ${WRKSRC}/interfaces/xmaxima -name 'Makefile.in' | ${XARGS} ${REINPLACE_CMD} "s;tclsh;${TCLSH};g"
@@ -70,14 +98,23 @@
post-patch-TEST-off:
${REINPLACE_CMD} 's;tests;;' ${WRKSRC}/Makefile.am
+post-patch-XMAXIMA-off:
+ ${REINPLACE_CMD} 's; xmaxima;;' ${WRKSRC}/interfaces/Makefile.am
+
+post-patch-XMAXIMA-on:
+ ${REINPLACE_CMD} "s;%%DOCSDIR%%;/${DOCSDIR:S,/, ,g};" \
+ ${WRKSRC}/interfaces/xmaxima/Tkmaxima/Paths.tcl
+
+post-configure:
+ ${REINPLACE_CMD} '/ld-flags/s|" |"|' ${WRKSRC}/src/autoconf-variables.lisp
+ ${REINPLACE_CMD} '/ld-flags/s| ")|")|' ${WRKSRC}/src/autoconf-variables.lisp
+
pre-build-CCL-on:
cd ${WRKSRC}/src/ && ${MKDIR} binary-ccl && ${LN} -s binary-ccl binary-openmcl
post-build-MANPAGES-on:
${GZIP_CMD} ${WRKSRC}/doc/man/maxima.1
-post-build-TEST-on: do-test
-
post-install:
for x in "" "-1" "-2" "-3"; do ${INSTALL_MAN} ${WRKSRC}/doc/info/maxima.info$$x ${STAGEDIR}${PREFIX}/${INFO_PATH}; done
${INSTALL_MAN} ${WRKSRC}/doc/info/maxima-index.lisp ${STAGEDIR}${PREFIX}/${INFO_PATH}
@@ -95,5 +132,10 @@
post-install-NOUSERINIT-on:
${REINPLACE_CMD} 's;--end-runtime-options;--end-runtime-options --no-userinit;' ${STAGEDIR}${PREFIX}/bin/maxima
+
+post-install-SAGE-on:
+ ${MKDIR} ${STAGEDIR}$$(${GET_ECLLIB})
+ ${INSTALL_DATA} ${WRKSRC}/src/binary-ecl/maxima.fas \
+ ${STAGEDIR}$$(${GET_ECLLIB})
.include <bsd.port.mk>
Index: head/math/maxima/files/extra-patch-share_linearalgebra_matrixexp.lisp
===================================================================
--- /dev/null
+++ head/math/maxima/files/extra-patch-share_linearalgebra_matrixexp.lisp
@@ -0,0 +1,14 @@
+--- share/linearalgebra/matrixexp.lisp.orig 2019-10-21 03:38:58 UTC
++++ share/linearalgebra/matrixexp.lisp
+@@ -138,8 +138,9 @@
+ (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))
++
++;; patch borrowed from SageMath
++ (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))
Index: head/math/maxima/files/extra-patch-src_grind.lisp
===================================================================
--- /dev/null
+++ head/math/maxima/files/extra-patch-src_grind.lisp
@@ -0,0 +1,18 @@
+--- src/grind.lisp.orig 2019-10-21 03:38:59 UTC
++++ src/grind.lisp
+@@ -297,12 +297,13 @@
+ (msz nil l r)
+ (do ((nl) (w 0))
+ ((null (cdr x))
+- (setq nl (cons (if (stringp (car x))
++;; Patch borrowed from SageMath: undoing_true_false_printing_patch
++ (setq nl (cons (if (atom (car x))
+ (msz (makestring (car x)) l r)
+ (msize (car x) l r lop rop))
+ nl))
+ (cons (+ w (caar nl)) (nreverse nl)))
+- (setq nl (cons (if (stringp (car x))
++ (setq nl (cons (if (atom (car x))
+ (msz (makestring (car x)) l r)
+ (msize (car x) l r lop rop))
+ nl)
Index: head/math/maxima/files/extra-patch-src_hayat.lisp
===================================================================
--- /dev/null
+++ head/math/maxima/files/extra-patch-src_hayat.lisp
@@ -0,0 +1,86 @@
+--- src/hayat.lisp.orig 2019-10-21 03:38:59 UTC
++++ src/hayat.lisp
+@@ -2205,6 +2205,25 @@
+ (or (alike1 (exp-pt (get-datum (datum-var (car l)))) (exp-pt (car l)))
+ (return () ))))
+
++;; Patch borrowed from SageMath: 0001-taylor2-Avoid-blowing-the-stack-when-diff-expand-isn
++;;
++;; SUBTREE-SEARCH
++;;
++;; Search for subtrees, ST, of TREE that contain an element equal to BRANCH
++;; under TEST as an immediate child and return them as a list.
++;;
++;; Examples:
++;; (SUBTREE-SEARCH 2 '(1 2 3)) => '((1 2 3))
++;; (SUBTREE-SEARCH 2 '(1 2 2 3)) => '((1 2 2 3))
++;; (SUBTREE-SEARCH 2 '(1 (2) 3)) => '((2))
++;; (SUBTREE-SEARCH 4 '(1 (2) 3)) => NIL
++;; (SUBTREE-SEARCH 2 '(1 (2) 3 (2))) => '((2) (2))
++
++(defun subtree-search (branch tree &optional (test 'equalp))
++ (unless (atom tree)
++ (if (find branch tree :test test) (list tree)
++ (mapcan (lambda (child) (subtree-search branch child test)) tree))))
++
+ (defun taylor2 (e)
+ (let ((last-exp e)) ;; lexp-non0 should be bound here when needed
+ (cond ((assolike e tlist) (var-expand e 1 () ))
+@@ -2248,9 +2267,32 @@
+ ((null l) t)
+ (or (free e (car l)) (return ()))))
+ (newsym e))
+- (t (let ((exact-poly () )) ; Taylor series aren't exact
+- (taylor2 (diff-expand e tlist)))))))
++ (t
++ ;; When all else fails, call diff-expand to try to expand e around the
++ ;; point as a Taylor series by taking repeated derivatives. This might
++ ;; fail, unfortunately: If a required derivative doesn't exist, then
++ ;; DIFF-EXPAND will return a form of the form "f'(x)" with the
++ ;; variable, rather than the expansion point in it.
++ ;;
++ ;; Sometimes this works - in particular, if there is a genuine pole at
++ ;; the point, we end up passing a sum of terms like x^(-k) to a
++ ;; recursive invocation and all is good. Unfortunately, it can also
++ ;; fail. For example, if e is abs(sin(x)) and we try to expand to first
++ ;; order, the expression "1/1*(cos(x)*sin(x)/abs(sin(x)))*x^1+0" is
++ ;; returned. If we call taylor2 on that, we will end up recursing and
++ ;; blowing the stack. To avoid doing so, error out if EXPANSION
++ ;; contains E as a subtree. However, don't error if it occurs as an
++ ;; argument to %DERIVATIVE (in which case, we might well be fine). This
++ ;; happens from things like taylor(log(f(x)), x, x0, 1).
+
++ (let* ((exact-poly nil) ; (Taylor series aren't exact)
++ (expansion (diff-expand e tlist)))
++ (when (find-if (lambda (subtree)
++ (not (eq ($op subtree) '%derivative)))
++ (subtree-search e expansion))
++ (exp-pt-err))
++ (taylor2 expansion))))))
++
+ (defun compatvarlist (a b c d)
+ (cond ((null a) t)
+ ((or (null b) (null c) (null d)) () )
+@@ -3024,7 +3066,21 @@
+ (and (or (member '$inf pt-list :test #'eq) (member '$minf pt-list :test #'eq))
+ (unfam-sing-err)))
+
+-(defun diff-expand (exp l) ;l is tlist
++;; DIFF-EXPAND
++;;
++;; Expand EXP in the variables as specified in L, which is a list of tlists. If
++;; L is a singleton, this just works by the classic Taylor expansion:
++;;
++;; f(x) = f(c) + f'(c) + f''(c)/2 + ... + f^(k)(c)/k!
++;;
++;; If L specifies multiple expansions, DIFF-EXPAND works recursively by
++;; expanding one variable at a time. The derivatives are computed using SDIFF.
++;;
++;; In some cases, f'(c) or some higher derivative might be an expression of the
++;; form 1/0. Instead of returning an error, DIFF-EXPAND uses f'(x)
++;; instead. (Note: This seems bogus to me (RJS), but I'm just describing how
++;; EVAL-DERIV works)
++(defun diff-expand (exp l)
+ (check-inf-sing (mapcar (function caddr) l))
+ (cond ((not l) exp)
+ (t
Index: head/math/maxima/files/extra-patch-src_init-cl.lisp
===================================================================
--- /dev/null
+++ head/math/maxima/files/extra-patch-src_init-cl.lisp
@@ -0,0 +1,12 @@
+--- src/init-cl.lisp.orig 2020-06-07 20:30:47 UTC
++++ src/init-cl.lisp
+@@ -137,7 +137,8 @@ When one changes, the other does too."
+ (setq libdir (combine-path maxima-prefix-env "lib"))
+ (setq libexecdir (combine-path maxima-prefix-env "libexec"))
+ (setq datadir (combine-path maxima-prefix-env "share"))
+- (setq infodir (combine-path maxima-prefix-env #+(or cygwin windows win32 win64) "share" "info")))
++ ;; patch borrowed from SageMath
++ (setq infodir (combine-path maxima-prefix-env "share" "info")))
+ (progn
+ (setq libdir (maxima-parse-dirstring *autoconf-libdir*))
+ (setq libexecdir (maxima-parse-dirstring *autoconf-libexecdir*))
Index: head/math/maxima/files/extra-patch-src_maxima.system
===================================================================
--- /dev/null
+++ head/math/maxima/files/extra-patch-src_maxima.system
@@ -0,0 +1,24 @@
+--- src/maxima.system.orig 2019-10-21 03:38:59 UTC
++++ src/maxima.system
+@@ -1,5 +1,8 @@
+ ;;; -*- Lisp -*-
+
++(require :cmp)
++(setf c::*compile-in-constants* t)
++
+ (in-package :cl-user)
+
+ (pushnew :cl *features*)
+@@ -75,6 +78,12 @@
+ ;; Convert dir/foo.fas to dir/foo.o
+ (make-pathname :type "o" :defaults p))
+ files)))
++;; Patch borrowed from SageMath: build the Maxima library
++ (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*"
Index: head/math/maxima/files/patch-interfaces_xmaxima_Tkmaxima_Paths.tcl
===================================================================
--- /dev/null
+++ head/math/maxima/files/patch-interfaces_xmaxima_Tkmaxima_Paths.tcl
@@ -0,0 +1,11 @@
+--- interfaces/xmaxima/Tkmaxima/Paths.tcl.orig 2020-06-08 10:58:28 UTC
++++ interfaces/xmaxima/Tkmaxima/Paths.tcl
+@@ -302,6 +302,8 @@ proc setMaxDir {} {
+ set maxima_priv(pReferenceToc) [file join $dir html maxima_toc.html]
+ }
+ }
++ } elseif {[file isdir [set dir [file join %%DOCSDIR%%]]]} {
++ set maxima_priv(pReferenceToc) [file join $dir maxima_toc.html]
+ } else {
+ tide_notify [M [mc "Documentation not found in '%s'"] \
+ [file native $maxima_priv(maxima_verpkgdatadir)]]
Index: head/math/maxima/pkg-plist
===================================================================
--- head/math/maxima/pkg-plist
+++ head/math/maxima/pkg-plist
@@ -1,6 +1,7 @@
bin/maxima
bin/rmaxima
-bin/xmaxima
+%%XMAXIMA%%bin/xmaxima
+%%SAGE%%lib/ecl-16.1.3/maxima.fas
lib/maxima/%%PORTVERSION%%/%%BINDIR%%/%%BINNAME%%
%%CMUCL%%lib/maxima/%%PORTVERSION%%/%%BINDIR%%/lisp
libexec/maxima/%%PORTVERSION%%/mgnuplot
@@ -27,7 +28,7 @@
share/metainfo/net.sourceforge.maxima.xmaxima.appdata.xml
share/mime/packages/x-mac.xml
share/mime/packages/x-maxima-out.xml
-share/pixmaps/net.sourceforge.maxima.png
-share/pixmaps/net.sourceforge.maxima.svg
+%%XMAXIMA%%share/pixmaps/net.sourceforge.maxima.png
+%%XMAXIMA%%share/pixmaps/net.sourceforge.maxima.svg
share/pixmaps/text-x-maxima-out.svg
share/pixmaps/text-x-maximasession.svg
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Feb 26, 8:37 PM (9 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16857593
Default Alt Text
D24959.id73085.diff (13 KB)
Attached To
Mode
D24959: math/maxima: Add ECL and SAGE options
Attached
Detach File
Event Timeline
Log In to Comment