From e3f6af7c8cae3ef288e1d865879612d94dc479ea Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Sun, 21 Dec 2014 20:30:46 +0300 Subject: [PATCH] Maxima-5.35.1: wish-1.patch removed. --- sci-mathematics/maxima/Manifest | 1 + .../maxima/files/50maxima-gentoo.el | 12 ++ sci-mathematics/maxima/files/clisp-0.patch | 19 ++ .../maxima/files/clozurecl-1.patch | 28 +++ sci-mathematics/maxima/files/cmucl-0.patch | 27 +++ sci-mathematics/maxima/files/ecls-1.patch | 37 ++++ sci-mathematics/maxima/files/imaxima-0.patch | 5 + sci-mathematics/maxima/files/rmaxima-0.patch | 25 +++ sci-mathematics/maxima/files/sbcl-0.patch | 26 +++ .../maxima/files/xdg-utils-0.patch | 35 ++++ sci-mathematics/maxima/maxima-5.35.1.ebuild | 190 ++++++++++++++++++ 11 files changed, 405 insertions(+) create mode 100644 sci-mathematics/maxima/Manifest create mode 100644 sci-mathematics/maxima/files/50maxima-gentoo.el create mode 100644 sci-mathematics/maxima/files/clisp-0.patch create mode 100644 sci-mathematics/maxima/files/clozurecl-1.patch create mode 100644 sci-mathematics/maxima/files/cmucl-0.patch create mode 100644 sci-mathematics/maxima/files/ecls-1.patch create mode 100644 sci-mathematics/maxima/files/imaxima-0.patch create mode 100644 sci-mathematics/maxima/files/rmaxima-0.patch create mode 100644 sci-mathematics/maxima/files/sbcl-0.patch create mode 100644 sci-mathematics/maxima/files/xdg-utils-0.patch create mode 100644 sci-mathematics/maxima/maxima-5.35.1.ebuild diff --git a/sci-mathematics/maxima/Manifest b/sci-mathematics/maxima/Manifest new file mode 100644 index 00000000..a79598dd --- /dev/null +++ b/sci-mathematics/maxima/Manifest @@ -0,0 +1 @@ +DIST maxima-5.35.1.tar.gz 29596145 SHA256 9ed1a996afdf7410a932842801c954c53b003983d07bafd7a1ea999fbcda98f3 SHA512 6a57ca5a4224f12f19863365f30fc87959a62787a4679ad3b1d9f180b86e5925b0af44aaffc4e1013dcb2f4fd4e88524d8eb8e8b0a501e1ebb6f2f3dbac19b17 WHIRLPOOL cc7b1aeb950a93df4e42690f713c090cc7ddb6a8e7f5789ea07017a6dd5984fe97b299eeb50efef0d764b2ff6aff0e6f4ec4b517446b663121ea14a62e375595 diff --git a/sci-mathematics/maxima/files/50maxima-gentoo.el b/sci-mathematics/maxima/files/50maxima-gentoo.el new file mode 100644 index 00000000..20c73991 --- /dev/null +++ b/sci-mathematics/maxima/files/50maxima-gentoo.el @@ -0,0 +1,12 @@ + +;;; maxima site-lisp configuration + +(add-to-list 'load-path "@SITELISP@") +(autoload 'maxima-mode "maxima" "Maxima mode" t) +(autoload 'maxima "maxima" "Maxima interactive" t) +(autoload 'dbl "dbl" "Make a debugger to run lisp, maxima and or gdb in" t) +(add-to-list 'auto-mode-alist '("\\.ma?[cx]\\'" . maxima-mode)) + +;; emaxima mode +(autoload 'emaxima-mode "emaxima" "EMaxima" t) +(add-hook 'emaxima-mode-hook 'emaxima-mark-file-as-emaxima) diff --git a/sci-mathematics/maxima/files/clisp-0.patch b/sci-mathematics/maxima/files/clisp-0.patch new file mode 100644 index 00000000..7e65c40b --- /dev/null +++ b/sci-mathematics/maxima/files/clisp-0.patch @@ -0,0 +1,19 @@ +diff -r -U1 maxima-5.30.0.orig/src/maxima.in maxima-5.30.0/src/maxima.in +--- maxima-5.30.0.orig/src/maxima.in 2012-12-04 12:54:50.000000000 +0700 ++++ maxima-5.30.0/src/maxima.in 2013-04-13 13:07:03.094128196 +0700 +@@ -138,5 +138,5 @@ + if [ -x "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" ]; then +- exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" $MAXIMA_LISP_OPTIONS -q "" -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9" ++ exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" $MAXIMA_LISP_OPTIONS -q -norc "" -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9" + else +- exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/@CLISP_RUNTIME@" $MAXIMA_LISP_OPTIONS -q -M "$maxima_image_base.mem" "" -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9" ++ exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/@CLISP_RUNTIME@" $MAXIMA_LISP_OPTIONS -q -norc -M "$maxima_image_base.mem" "" -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9" + fi +@@ -144,5 +144,5 @@ + if [ -x "$maxima_image_base" ]; then +- exec "$maxima_image_base" $MAXIMA_LISP_OPTIONS -q "" -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9" ++ exec "$maxima_image_base" $MAXIMA_LISP_OPTIONS -q -norc "" -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9" + else +- exec "@CLISP_NAME@" $MAXIMA_LISP_OPTIONS -q -M "$maxima_image_base.mem" "" -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9" ++ exec "@CLISP_NAME@" $MAXIMA_LISP_OPTIONS -q -norc -M "$maxima_image_base.mem" "" -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9" + fi diff --git a/sci-mathematics/maxima/files/clozurecl-1.patch b/sci-mathematics/maxima/files/clozurecl-1.patch new file mode 100644 index 00000000..07203a2f --- /dev/null +++ b/sci-mathematics/maxima/files/clozurecl-1.patch @@ -0,0 +1,28 @@ +diff -r -U1 maxima-5.35.1.orig/configure.ac maxima-5.35.1/configure.ac +--- maxima-5.35.1.orig/configure.ac 2014-12-13 06:44:51.000000000 +0600 ++++ maxima-5.35.1/configure.ac 2014-12-20 20:43:04.713305777 +0600 +@@ -379,3 +379,3 @@ + dnl n.b. openmcl_default_name is hardcoded in "with" message +-openmcl_default_name=openmcl ++openmcl_default_name=ccl + AC_ARG_ENABLE(openmcl, +diff -r -U1 maxima-5.35.1.orig/src/Makefile.am maxima-5.35.1/src/Makefile.am +--- maxima-5.35.1.orig/src/Makefile.am 2014-09-24 00:02:16.000000000 +0700 ++++ maxima-5.35.1/src/Makefile.am 2014-12-20 20:43:04.713305777 +0600 +@@ -359,3 +359,3 @@ + +-EXECUTEOPENMCL = $(OPENMCL_NAME) -e ++EXECUTEOPENMCL = $(OPENMCL_NAME) --no-init -e + BUILT_FILES += $(OPENMCL_MAXIMA) +Только в maxima-5.35.1/src: Makefile.am.orig +diff -r -U1 maxima-5.35.1.orig/src/maxima.in maxima-5.35.1/src/maxima.in +--- maxima-5.35.1.orig/src/maxima.in 2014-12-03 04:17:05.000000000 +0600 ++++ maxima-5.35.1/src/maxima.in 2014-12-20 20:43:04.713305777 +0600 +@@ -185,5 +185,5 @@ + if [ -x "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" ]; then +- exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" $MAXIMA_LISP_OPTIONS -e '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9" ++ exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" $MAXIMA_LISP_OPTIONS --no-init -e '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9" + else +- exec "@OPENMCL_NAME@" -I "$maxima_image_base.image" $MAXIMA_LISP_OPTIONS -e '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9" ++ exec "@OPENMCL_NAME@" -I "$maxima_image_base.image" $MAXIMA_LISP_OPTIONS --no-init -e '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9" + fi diff --git a/sci-mathematics/maxima/files/cmucl-0.patch b/sci-mathematics/maxima/files/cmucl-0.patch new file mode 100644 index 00000000..73ebd344 --- /dev/null +++ b/sci-mathematics/maxima/files/cmucl-0.patch @@ -0,0 +1,27 @@ +diff -r -U1 maxima-5.30.0.orig/src/Makefile.am maxima-5.30.0/src/Makefile.am +--- maxima-5.30.0.orig/src/Makefile.am 2013-03-23 08:32:07.000000000 +0700 ++++ maxima-5.30.0/src/Makefile.am 2013-04-13 13:12:37.521437190 +0700 +@@ -77,3 +77,3 @@ + if CMUCL +-EXECUTECMUCL = $(CMUCL_NAME) -noinit -batch ++EXECUTECMUCL = $(CMUCL_NAME) -nositeinit -noinit -batch + # Newer versions of CMUCL have an INTL package that is compatible with +diff -r -U1 maxima-5.30.0.orig/src/maxima.in maxima-5.30.0/src/maxima.in +--- maxima-5.30.0.orig/src/maxima.in 2012-12-04 12:54:50.000000000 +0700 ++++ maxima-5.30.0/src/maxima.in 2013-04-13 13:11:26.647371277 +0700 +@@ -155,5 +155,5 @@ + if [ -x "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" ]; then +- exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" $MAXIMA_LISP_OPTIONS -quiet -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9" ++ exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" $MAXIMA_LISP_OPTIONS -quiet -nositeinit -noinit -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9" + else +- exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/@CMUCL_RUNTIME@" $MAXIMA_LISP_OPTIONS -quiet -core "$maxima_image_base.core" -eval '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9" ++ exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/@CMUCL_RUNTIME@" $MAXIMA_LISP_OPTIONS -quiet -nositeinit -noinit -core "$maxima_image_base.core" -eval '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9" + fi +@@ -161,5 +161,5 @@ + if [ -x "$maxima_image_base" ]; then +- exec "$maxima_image_base" $MAXIMA_LISP_OPTIONS -quiet -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9" ++ exec "$maxima_image_base" $MAXIMA_LISP_OPTIONS -quiet -nositeinit -noinit -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9" + else +- exec "@CMUCL_NAME@" $MAXIMA_LISP_OPTIONS -quiet -core "$maxima_image_base.core" -eval '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9" ++ exec "@CMUCL_NAME@" $MAXIMA_LISP_OPTIONS -quiet -nositeinit -noinit -core "$maxima_image_base.core" -eval '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9" + fi diff --git a/sci-mathematics/maxima/files/ecls-1.patch b/sci-mathematics/maxima/files/ecls-1.patch new file mode 100644 index 00000000..36e9af17 --- /dev/null +++ b/sci-mathematics/maxima/files/ecls-1.patch @@ -0,0 +1,37 @@ +diff -r -U1 maxima-5.30.0.orig/src/maxima.in maxima-5.30.0/src/maxima.in +--- maxima-5.30.0.orig/src/maxima.in 2012-12-04 12:54:50.000000000 +0700 ++++ maxima-5.30.0/src/maxima.in 2013-04-13 12:57:12.037579805 +0700 +@@ -191,3 +191,3 @@ + elif [ "$MAXIMA_LISP" = "ecl" ]; then +- exec "$maxima_image_base" $MAXIMA_LISP_OPTIONS -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9" ++ exec "$maxima_image_base" $MAXIMA_LISP_OPTIONS -norc -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9" + +diff -r -U1 maxima-5.30.0.orig/src/maxima.system maxima-5.30.0/src/maxima.system +--- maxima-5.30.0.orig/src/maxima.system 2013-03-23 08:32:08.000000000 +0700 ++++ maxima-5.30.0/src/maxima.system 2013-04-13 12:59:54.086730845 +0700 +@@ -61,2 +61,10 @@ + #+ecl ++(defun split-ld-flags-for-ecl (string &aux space) ++ (setf string (string-trim '(#\Space) string)) ++ (if (setf space (position #\Space string)) ++ (cons (subseq string 0 space) ++ (split-ld-flags-for-ecl (subseq string (1+ space)))) ++ (cons string nil))) ++ ++#+ecl + (defun build-maxima-lib () +@@ -77,7 +85,12 @@ + 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 ""))) (split-ld-flags-for-ecl 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-ld-flags-for-ecl x))) + :epilogue-code '(progn (require :defsystem) + diff --git a/sci-mathematics/maxima/files/imaxima-0.patch b/sci-mathematics/maxima/files/imaxima-0.patch new file mode 100644 index 00000000..fe607b24 --- /dev/null +++ b/sci-mathematics/maxima/files/imaxima-0.patch @@ -0,0 +1,5 @@ +--- interfaces/emacs/Makefile.am.orig 2010-02-01 22:11:44.809941160 +1300 ++++ interfaces/emacs/Makefile.am 2010-02-01 22:12:06.608062346 +1300 +@@ -1 +1 @@ +-SUBDIRS = emaxima misc imaxima ++SUBDIRS = emaxima misc diff --git a/sci-mathematics/maxima/files/rmaxima-0.patch b/sci-mathematics/maxima/files/rmaxima-0.patch new file mode 100644 index 00000000..712cbda1 --- /dev/null +++ b/sci-mathematics/maxima/files/rmaxima-0.patch @@ -0,0 +1,25 @@ +diff -r -U2 maxima-5.28.0.orig/src/Makefile.am maxima-5.28.0/src/Makefile.am +--- maxima-5.28.0.orig/src/Makefile.am 2012-06-15 12:21:34.000000000 +0700 ++++ maxima-5.28.0/src/Makefile.am 2012-10-30 22:22:29.000000000 +0700 +@@ -4,5 +4,21 @@ + bin_SCRIPTS = maxima maxima-command.ico maxima.bat set_lang.vbs + else ++if SBCL + bin_SCRIPTS = maxima rmaxima ++else ++if CMUCL ++bin_SCRIPTS = maxima rmaxima ++else ++if ECL ++bin_SCRIPTS = maxima rmaxima ++else ++if OPENMCL ++bin_SCRIPTS = maxima rmaxima ++else ++bin_SCRIPTS = maxima ++endif ++endif ++endif ++endif + endif + diff --git a/sci-mathematics/maxima/files/sbcl-0.patch b/sci-mathematics/maxima/files/sbcl-0.patch new file mode 100644 index 00000000..5c2bdf7b --- /dev/null +++ b/sci-mathematics/maxima/files/sbcl-0.patch @@ -0,0 +1,26 @@ +diff -r -U1 maxima-5.30.0.orig/src/Makefile.am maxima-5.30.0/src/Makefile.am +--- maxima-5.30.0.orig/src/Makefile.am 2013-03-23 08:32:07.000000000 +0700 ++++ maxima-5.30.0/src/Makefile.am 2013-04-13 14:36:39.977014432 +0700 +@@ -199,3 +199,3 @@ + if SBCL +-EXECUTESBCL = "$(SBCL_NAME)" --noinform --noprint --eval ++EXECUTESBCL = "$(SBCL_NAME)" --noinform --noprint --no-sysinit --no-userinit --eval + all-local: sharefiles.mk $(SBCL_MAXIMA) +diff -r -U1 maxima-5.30.0.orig/src/maxima.in maxima-5.30.0/src/maxima.in +--- maxima-5.30.0.orig/src/maxima.in 2012-12-04 12:54:50.000000000 +0700 ++++ maxima-5.30.0/src/maxima.in 2013-04-13 14:36:39.977014432 +0700 +@@ -196,5 +196,5 @@ + if [ -x "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" ]; then +- exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" --noinform $MAXIMA_LISP_OPTIONS --end-runtime-options --eval '(cl-user::run)' --end-toplevel-options "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9" ++ exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" --noinform $MAXIMA_LISP_OPTIONS --end-runtime-options --no-sysinit --no-userinit --eval '(cl-user::run)' --end-toplevel-options "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9" + else +- exec "@SBCL_NAME@" --core "$maxima_image_base.core" --noinform $MAXIMA_LISP_OPTIONS --end-runtime-options --eval '(cl-user::run)' --end-toplevel-options "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9" ++ exec "@SBCL_NAME@" --core "$maxima_image_base.core" --noinform $MAXIMA_LISP_OPTIONS --end-runtime-options --no-sysinit --no-userinit --eval '(cl-user::run)' --end-toplevel-options "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9" + fi +diff -r -U1 maxima-5.30.0.orig/src/server.lisp maxima-5.30.0/src/server.lisp +--- maxima-5.30.0.orig/src/server.lisp 2012-11-19 04:40:51.000000000 +0700 ++++ maxima-5.30.0/src/server.lisp 2013-04-13 14:37:19.937051659 +0700 +@@ -10,3 +10,2 @@ + (eval-when (:compile-toplevel :load-toplevel :execute) +- #+sbcl (require 'asdf) ;not needed here for a recent SBCL + #+sbcl (require 'sb-posix) diff --git a/sci-mathematics/maxima/files/xdg-utils-0.patch b/sci-mathematics/maxima/files/xdg-utils-0.patch new file mode 100644 index 00000000..876fe6fc --- /dev/null +++ b/sci-mathematics/maxima/files/xdg-utils-0.patch @@ -0,0 +1,35 @@ +--- interfaces/emacs/misc/bookmode.el.orig 2008-02-07 12:42:18.008472937 +0000 ++++ interfaces/emacs/misc/bookmode.el 2008-02-07 12:43:02.531010132 +0000 +@@ -680,7 +680,7 @@ + + (and tem + (list (concat "View "(nth 1 tem)) +- 'call-process "ghostview" nil nil nil ++ 'call-process "xdg-open" nil nil nil + (expand-file-name(nth 1 tem)) + )) + (list "Cancel") +@@ -705,7 +705,7 @@ + (concat + (cond ((looking-at "%PS") "") + (t "gzip -dc | ")) +- "ghostview -") ++ "xdg-open -") + + ))) + +--- interfaces/xmaxima/Tkmaxima/Constants.tcl.orig 2008-02-07 12:42:47.294141832 +0000 ++++ interfaces/xmaxima/Tkmaxima/Constants.tcl 2008-02-07 12:43:02.539010587 +0000 +@@ -143,9 +143,9 @@ + image/gif netmath + image/png netmath + image/jpeg netmath +- application/postscript "ghostview -safer %s" +- application/pdf "acroread %s" +- application/x-dvi "xdvi %s" ++ application/postscript "xdg-open -safer %s" ++ application/pdf "xdg-open %s" ++ application/x-dvi "xdg-open %s" + } + set maxima_priv(imagecounter) 0 + diff --git a/sci-mathematics/maxima/maxima-5.35.1.ebuild b/sci-mathematics/maxima/maxima-5.35.1.ebuild new file mode 100644 index 00000000..38c5942e --- /dev/null +++ b/sci-mathematics/maxima/maxima-5.35.1.ebuild @@ -0,0 +1,190 @@ +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sci-mathematics/maxima/maxima-5.35.1.ebuild,v 1.1 2014/12/20 15:41:27 grozin Exp $ + +EAPI=5 + +inherit autotools elisp-common eutils + +DESCRIPTION="Free computer algebra environment based on Macsyma" +HOMEPAGE="http://maxima.sourceforge.net/" +SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~ppc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos" + +# Supported lisps +LISPS=( sbcl cmucl gcl ecls clozurecl clisp ) +# supports readline: . - no, y - yes +SUPP_RL=( . . y . . y ) +# . - just --enable-, - --enable- +CONF_FLAG=( . . . ecl ccl . ) +# patch file version; . - no patch +PATCH_V=( 0 0 . 1 1 0 ) + +IUSE="latex emacs tk nls unicode xemacs X ${LISPS[*]}" + +# Languages +LANGS="es pt pt_BR" +for lang in ${LANGS}; do + IUSE="${IUSE} linguas_${lang}" +done + +RDEPEND="X? ( x11-misc/xdg-utils + sci-visualization/gnuplot[gd] + tk? ( dev-lang/tk ) ) + latex? ( virtual/latex-base ) + emacs? ( virtual/emacs + latex? ( app-emacs/auctex ) ) + xemacs? ( app-editors/xemacs + latex? ( app-emacs/auctex ) )" + +PDEPEND="emacs? ( app-emacs/imaxima )" + +# generating lisp dependencies +depends() { + local LISP DEP + LISP=${LISPS[$1]} + DEP="dev-lisp/${LISP}:=" + if [ "${SUPP_RL[$1]}" = "." ]; then + DEP="${DEP} app-misc/rlwrap" + fi + echo ${DEP} +} + +n=${#LISPS[*]} +for ((n--; n >= 0; n--)); do + LISP=${LISPS[${n}]} + RDEPEND="${RDEPEND} ${LISP}? ( $(depends ${n}) )" + if (( ${n} > 0 )); then + DEF_DEP="${DEF_DEP} !${LISP}? ( " + fi +done + +# default lisp +if use arm; then + DEF_LISP=2 # gcl +else + DEF_LISP=0 # sbcl +fi + +DEF_DEP="${DEF_DEP} `depends ${DEF_LISP}`" + +n=${#LISPS[*]} +for ((n--; n > 0; n--)); do + DEF_DEP="${DEF_DEP} )" +done + +unset LISP + +RDEPEND="${RDEPEND} + ${DEF_DEP}" + +DEPEND="${RDEPEND} + sys-apps/texinfo" + +TEXMF="${EPREFIX}"/usr/share/texmf-site + +pkg_setup() { + local n=${#LISPS[*]} + + for ((n--; n >= 0; n--)); do + use ${LISPS[${n}]} && NLISPS="${NLISPS} ${n}" + done + + if [ -z "${NLISPS}" ]; then + ewarn "No lisp specified in USE flags, choosing ${LISPS[${DEF_LISP}]} as default" + NLISPS=${DEF_LISP} + fi +} + +src_prepare() { + local n PATCHES v + PATCHES=( imaxima-0 rmaxima-0 xdg-utils-0 ) + + n=${#PATCHES[*]} + for ((n--; n >= 0; n--)); do + epatch "${FILESDIR}"/${PATCHES[${n}]}.patch + done + + n=${#LISPS[*]} + for ((n--; n >= 0; n--)); do + v=${PATCH_V[${n}]} + if [ "${v}" != "." ]; then + epatch "${FILESDIR}"/${LISPS[${n}]}-${v}.patch + fi + done + + # bug #343331 + rm share/Makefile.in || die + rm src/Makefile.in || die + touch src/*.mk + touch src/Makefile.am + eautoreconf +} + +src_configure() { + local CONFS CONF n lang + for n in ${NLISPS}; do + CONF=${CONF_FLAG[${n}]} + if [ ${CONF} = . ]; then + CONF=${LISPS[${n}]} + fi + CONFS="${CONFS} --enable-${CONF}" + done + + # enable existing translated doc + if use nls; then + for lang in ${LANGS}; do + if use "linguas_${lang}"; then + CONFS="${CONFS} --enable-lang-${lang}" + use unicode && CONFS="${CONFS} --enable-lang-${lang}-utf8" + fi + done + fi + + econf ${CONFS} $(use_with tk wish) --with-lispdir="${SITELISP}"/${PN} +} + +src_install() { + docompress -x /usr/share/info + emake DESTDIR="${D}" emacsdir="${SITELISP}/${PN}" install + + use tk && make_desktop_entry xmaxima xmaxima \ + /usr/share/${PN}/${PV}/xmaxima/maxima-new.png \ + "Science;Math;Education" + + if use latex; then + insinto ${TEXMF}/tex/latex/emaxima + doins interfaces/emacs/emaxima/emaxima.sty + fi + + # do not use dodoc because interfaces can't read compressed files + # read COPYING before attempt to remove it from dodoc + insinto /usr/share/${PN}/${PV}/doc + doins AUTHORS COPYING README README.lisps || die + dodir /usr/share/doc + dosym ../${PN}/${PV}/doc /usr/share/doc/${PF} || die + + if use emacs; then + elisp-site-file-install "${FILESDIR}"/50maxima-gentoo.el || die + fi + + # if we use ecls, build an ecls library for maxima + if use ecls; then + ECLLIB=`ecl -eval "(princ (SI:GET-LIBRARY-PATHNAME))" -eval "(quit)"` + insinto "${ECLLIB#${EPREFIX}}" + doins src/binary-ecl/maxima.fas + fi +} + +pkg_postinst() { + use emacs && elisp-site-regen + use latex && mktexlsr +} + +pkg_postrm() { + use emacs && elisp-site-regen + use latex && mktexlsr +}