commit:     0547f4e74b206aa4fc02746df0e929a3b8777d19
Author:     Andrey Grozin <grozin <AT> gentoo <DOT> org>
AuthorDate: Wed Sep  5 15:26:17 2018 +0000
Commit:     Andrey Grozin <grozin <AT> gentoo <DOT> org>
CommitDate: Wed Sep  5 15:26:17 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0547f4e7

sci-mathematics/maxima: be compatible with emacs-27

add the upstream patch
bump to eapi 6
Closes: https://bugs.gentoo.org/664848
Package-Manager: Portage-2.3.41, Repoman-2.3.9

 sci-mathematics/maxima/files/emacs-27.patch    |  10 ++
 sci-mathematics/maxima/files/xdg-utils-1.patch |  31 ++++
 sci-mathematics/maxima/maxima-5.41.0-r2.ebuild | 212 +++++++++++++++++++++++++
 3 files changed, 253 insertions(+)

diff --git a/sci-mathematics/maxima/files/emacs-27.patch 
b/sci-mathematics/maxima/files/emacs-27.patch
new file mode 100644
index 00000000000..ded11659900
--- /dev/null
+++ b/sci-mathematics/maxima/files/emacs-27.patch
@@ -0,0 +1,10 @@
+diff -r -U2 maxima-5.41.0.orig/interfaces/emacs/imaxima/imaxima.el 
maxima-5.41.0/interfaces/emacs/imaxima/imaxima.el
+--- maxima-5.41.0.orig/interfaces/emacs/imaxima/imaxima.el     2016-04-03 
03:42:45.000000000 +0600
++++ maxima-5.41.0/interfaces/emacs/imaxima/imaxima.el  2018-09-05 
20:29:46.843231210 +0700
+@@ -528,5 +528,5 @@
+     (set-process-filter imaxima-gs-process 'imaxima-gs-filter)
+     (imaxima-gs-wait)
+-    (process-kill-without-query imaxima-gs-process nil)
++    (set-process-query-on-exit-flag imaxima-gs-process nil)
+     (unless (eq (process-status imaxima-gs-process) 'run)
+       (setq output (shell-command-to-string (concat imaxima-gs-program " 
-h")))

diff --git a/sci-mathematics/maxima/files/xdg-utils-1.patch 
b/sci-mathematics/maxima/files/xdg-utils-1.patch
new file mode 100644
index 00000000000..4150eb52cb9
--- /dev/null
+++ b/sci-mathematics/maxima/files/xdg-utils-1.patch
@@ -0,0 +1,31 @@
+diff -r -U2 maxima-5.41.0.orig/interfaces/emacs/misc/bookmode.el 
maxima-5.41.0/interfaces/emacs/misc/bookmode.el
+--- maxima-5.41.0.orig/interfaces/emacs/misc/bookmode.el       2017-05-29 
05:30:43.000000000 +0700
++++ maxima-5.41.0/interfaces/emacs/misc/bookmode.el    2018-09-05 
20:53:02.518172515 +0700
+@@ -681,5 +681,5 @@
+                 (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))
+                            ))
+@@ -706,5 +706,5 @@
+                         (cond ((looking-at "%PS") "")
+                               (t "gzip -dc | "))
+-                        "ghostview -")
++                        "xdg-open -")
+                        
+       )))
+diff -r -U2 maxima-5.41.0.orig/interfaces/xmaxima/Tkmaxima/Constants.tcl 
maxima-5.41.0/interfaces/xmaxima/Tkmaxima/Constants.tcl
+--- maxima-5.41.0.orig/interfaces/xmaxima/Tkmaxima/Constants.tcl       
2016-04-03 03:42:45.000000000 +0600
++++ maxima-5.41.0/interfaces/xmaxima/Tkmaxima/Constants.tcl    2018-09-05 
20:55:25.180166516 +0700
+@@ -154,7 +154,7 @@
+     image/png  netmath
+     image/jpeg netmath
+-    application/postscript "ghostview -safer %s"
+-    application/pdf "acroread %s"
+-    application/x-dvi "xdvi %s"
++    application/postscript "xdg-open %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.41.0-r2.ebuild 
b/sci-mathematics/maxima/maxima-5.41.0-r2.ebuild
new file mode 100644
index 00000000000..c09441ad802
--- /dev/null
+++ b/sci-mathematics/maxima/maxima-5.41.0-r2.ebuild
@@ -0,0 +1,212 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit autotools elisp-common eutils xdg-utils
+
+DESCRIPTION="Free computer algebra environment based on Macsyma"
+HOMEPAGE="http://maxima.sourceforge.net/";
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
+
+LICENSE="GPL-2 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 )
+# <lisp> supports readline: . - no, y - yes
+SUPP_RL=(   .    .     y               .    .         y     )
+# . - just --enable-<lisp>, <flag> - --enable-<flag>
+CONF_FLAG=( .    .     .               ecl  ccl       .     )
+# patch file version; . - no patch
+PATCH_V=(   2    1     .               2    2         1     )
+
+IUSE="emacs tk nls unicode X ${LISPS[*]}"
+
+# Languages
+LANGS="de es pt pt_BR"
+for lang in ${LANGS}; do
+       IUSE="${IUSE} l10n_${lang/_/-}"
+done
+
+# texlive-latexrecommended needed by imaxima for breqn.sty
+RDEPEND="!app-emacs/imaxima
+       X? ( x11-misc/xdg-utils
+                sci-visualization/gnuplot[gd]
+                tk? ( dev-lang/tk:0 ) )
+       emacs? ( virtual/emacs
+               virtual/latex-base
+               app-emacs/auctex
+               app-text/ghostscript-gpl
+               dev-texlive/texlive-latexrecommended )"
+
+# 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}) )"
+       DEF_DEP="${DEF_DEP} !${LISP}? ( "
+done
+
+# default lisp
+DEF_LISP=0 # sbcl
+ARM_LISP=2 # gcl
+DEF_DEP="${DEF_DEP} arm? ( `depends ${ARM_LISP}` ) !arm? ( `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
+               use arm && DEF_LISP=${ARM_LISP}
+               ewarn "No lisp specified in USE flags, choosing 
${LISPS[${DEF_LISP}]} as default"
+               NLISPS=${DEF_LISP}
+       fi
+}
+
+src_prepare() {
+       local n PATCHES v
+       PATCHES=( emacs-0 emacs-27 rmaxima-0 wish-2 xdg-utils-1 )
+
+       n=${#PATCHES[*]}
+       for ((n--; n >= 0; n--)); do
+               eapply "${FILESDIR}"/${PATCHES[${n}]}.patch
+       done
+
+       n=${#LISPS[*]}
+       for ((n--; n >= 0; n--)); do
+               v=${PATCH_V[${n}]}
+               if [ "${v}" != "." ]; then
+                       eapply "${FILESDIR}"/${LISPS[${n}]}-${v}.patch
+               fi
+       done
+
+       eapply_user
+
+       # 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 "l10n_${lang/_/-}"; then
+                               CONFS="${CONFS} --enable-lang-${lang}"
+                               use unicode && CONFS="${CONFS} 
--enable-lang-${lang}-utf8"
+                       fi
+               done
+       fi
+
+       econf ${CONFS} \
+               $(use_with tk wish) \
+               $(use_enable emacs) \
+               --with-lispdir="${EPREFIX}/${SITELISP}/${PN}"
+}
+
+src_compile() {
+       emake
+       if use emacs; then
+               pushd interfaces/emacs/emaxima > /dev/null
+               elisp-compile *.el
+               popd > /dev/null
+               pushd interfaces/emacs/imaxima > /dev/null
+               BYTECOMPFLAGS="-L . -L ../emaxima"
+               elisp-compile *.el
+               popd > /dev/null
+       fi
+}
+
+src_install() {
+       docompress -x /usr/share/info
+       emake DESTDIR="${D}" emacsdir="${EPREFIX}/${SITELISP}/${PN}" install
+
+       use tk && make_desktop_entry xmaxima xmaxima \
+               /usr/share/${PN}/${PV}/xmaxima/maxima-new.png \
+               "Science;Math;Education"
+
+       # 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
+       dodir /usr/share/doc
+       dosym ../${PN}/${PV}/doc /usr/share/doc/${PF}
+
+       if use emacs; then
+               elisp-install ${PN} 
interfaces/emacs/{emaxima,imaxima}/*.{el,elc,lisp}
+               elisp-site-file-install "${FILESDIR}"/50maxima-gentoo-1.el
+
+               rm "${ED}"/${SITELISP}/${PN}/emaxima.sty || die
+               insinto ${TEXMF}/tex/latex/emaxima
+               doins interfaces/emacs/emaxima/emaxima.sty
+
+               insinto /usr/share/${PN}/${PV}/doc/imaxima
+               doins interfaces/emacs/imaxima/README
+               doins -r interfaces/emacs/imaxima/imath-example
+       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() {
+       xdg_mimeinfo_database_update
+       if use emacs; then
+               elisp-site-regen
+               mktexlsr
+       fi
+}
+
+pkg_postrm() {
+       xdg_mimeinfo_database_update
+       if use emacs; then
+               elisp-site-regen
+               mktexlsr
+       fi
+}

Reply via email to