maxima-5.37.3-r4.ebuild 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. # Copyright 1999-2015 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. inherit autotools elisp-common eutils
  5. DESCRIPTION="Free computer algebra environment based on Macsyma"
  6. HOMEPAGE="http://maxima.sourceforge.net/"
  7. SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
  8. LICENSE="GPL-2 GPL-2+"
  9. SLOT="0"
  10. KEYWORDS="amd64 ~ppc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos"
  11. # Supported lisps
  12. LISPS=( sbcl cmucl gcl ecls clozurecl clisp )
  13. # <lisp> supports readline: . - no, y - yes
  14. SUPP_RL=( . . y . . y )
  15. # . - just --enable-<lisp>, <flag> - --enable-<flag>
  16. CONF_FLAG=( . . . ecl ccl . )
  17. # patch file version; . - no patch
  18. PATCH_V=( 1 1 . 2 2 1 )
  19. IUSE="emacs tk nls unicode X ${LISPS[*]}"
  20. # Languages
  21. LANGS="de es pt pt_BR"
  22. for lang in ${LANGS}; do
  23. IUSE="${IUSE} linguas_${lang}"
  24. done
  25. # texlive-latexrecommended needed by imaxima for breqn.sty
  26. RDEPEND="!app-emacs/imaxima
  27. X? ( x11-misc/xdg-utils
  28. sci-visualization/gnuplot[gd]
  29. tk? ( dev-lang/tk:0 ) )
  30. emacs? ( virtual/emacs
  31. virtual/latex-base
  32. app-emacs/auctex
  33. app-text/ghostscript-gpl
  34. dev-texlive/texlive-latexrecommended )"
  35. # generating lisp dependencies
  36. depends() {
  37. local LISP DEP
  38. LISP=${LISPS[$1]}
  39. DEP="dev-lisp/${LISP}:="
  40. if [ "${SUPP_RL[$1]}" = "." ]; then
  41. DEP="${DEP} app-misc/rlwrap"
  42. fi
  43. echo ${DEP}
  44. }
  45. n=${#LISPS[*]}
  46. for ((n--; n >= 0; n--)); do
  47. LISP=${LISPS[${n}]}
  48. RDEPEND="${RDEPEND} ${LISP}? ( $(depends ${n}) )"
  49. DEF_DEP="${DEF_DEP} !${LISP}? ( "
  50. done
  51. # default lisp
  52. DEF_LISP=0 # sbcl
  53. ARM_LISP=2 # gcl
  54. DEF_DEP="${DEF_DEP} arm? ( `depends ${ARM_LISP}` ) !arm? ( `depends ${DEF_LISP}` )"
  55. n=${#LISPS[*]}
  56. for ((n--; n >= 0; n--)); do
  57. DEF_DEP="${DEF_DEP} )"
  58. done
  59. unset LISP
  60. RDEPEND="${RDEPEND}
  61. ${DEF_DEP}"
  62. DEPEND="${RDEPEND}
  63. sys-apps/texinfo"
  64. TEXMF="${EPREFIX}"/usr/share/texmf-site
  65. pkg_setup() {
  66. local n=${#LISPS[*]}
  67. for ((n--; n >= 0; n--)); do
  68. use ${LISPS[${n}]} && NLISPS="${NLISPS} ${n}"
  69. done
  70. if [ -z "${NLISPS}" ]; then
  71. use arm && DEF_LISP=${ARM_LISP}
  72. ewarn "No lisp specified in USE flags, choosing ${LISPS[${DEF_LISP}]} as default"
  73. NLISPS=${DEF_LISP}
  74. fi
  75. }
  76. src_prepare() {
  77. local n PATCHES v
  78. PATCHES=( emacs-0 rmaxima-0 wish-2 xdg-utils-0 db-0 )
  79. n=${#PATCHES[*]}
  80. for ((n--; n >= 0; n--)); do
  81. epatch "${FILESDIR}"/${PATCHES[${n}]}.patch
  82. done
  83. n=${#LISPS[*]}
  84. for ((n--; n >= 0; n--)); do
  85. v=${PATCH_V[${n}]}
  86. if [ "${v}" != "." ]; then
  87. epatch "${FILESDIR}"/${LISPS[${n}]}-${v}.patch
  88. fi
  89. done
  90. # bug #343331
  91. rm share/Makefile.in || die
  92. rm src/Makefile.in || die
  93. touch src/*.mk
  94. touch src/Makefile.am
  95. eautoreconf
  96. }
  97. src_configure() {
  98. local CONFS CONF n lang
  99. for n in ${NLISPS}; do
  100. CONF=${CONF_FLAG[${n}]}
  101. if [ ${CONF} = . ]; then
  102. CONF=${LISPS[${n}]}
  103. fi
  104. CONFS="${CONFS} --enable-${CONF}"
  105. done
  106. # enable existing translated doc
  107. if use nls; then
  108. for lang in ${LANGS}; do
  109. if use "linguas_${lang}"; then
  110. CONFS="${CONFS} --enable-lang-${lang}"
  111. use unicode && CONFS="${CONFS} --enable-lang-${lang}-utf8"
  112. fi
  113. done
  114. fi
  115. econf ${CONFS} \
  116. $(use_with tk wish) \
  117. $(use_enable emacs) \
  118. --with-lispdir="${EPREFIX}/${SITELISP}/${PN}"
  119. }
  120. src_compile() {
  121. emake
  122. if use emacs; then
  123. pushd interfaces/emacs/emaxima > /dev/null
  124. elisp-compile *.el
  125. popd > /dev/null
  126. pushd interfaces/emacs/imaxima > /dev/null
  127. BYTECOMPFLAGS="-L . -L ../emaxima"
  128. elisp-compile *.el
  129. popd > /dev/null
  130. fi
  131. }
  132. src_install() {
  133. docompress -x /usr/share/info
  134. emake DESTDIR="${D}" emacsdir="${EPREFIX}/${SITELISP}/${PN}" install
  135. use tk && make_desktop_entry xmaxima xmaxima \
  136. /usr/share/${PN}/${PV}/xmaxima/maxima-new.png \
  137. "Science;Math;Education"
  138. # do not use dodoc because interfaces can't read compressed files
  139. # read COPYING before attempt to remove it from dodoc
  140. insinto /usr/share/${PN}/${PV}/doc
  141. doins AUTHORS COPYING README README.lisps
  142. dodir /usr/share/doc
  143. dosym ../${PN}/${PV}/doc /usr/share/doc/${PF}
  144. if use emacs; then
  145. elisp-install ${PN} interfaces/emacs/{emaxima,imaxima}/*.{el,elc,lisp}
  146. elisp-site-file-install "${FILESDIR}"/50maxima-gentoo-1.el
  147. rm "${ED}"/${SITELISP}/${PN}/emaxima.sty || die
  148. insinto ${TEXMF}/tex/latex/emaxima
  149. doins interfaces/emacs/emaxima/emaxima.sty
  150. insinto /usr/share/${PN}/${PV}/doc/imaxima
  151. doins interfaces/emacs/imaxima/README
  152. doins -r interfaces/emacs/imaxima/imath-example
  153. fi
  154. # if we use ecls, build an ecls library for maxima
  155. if use ecls; then
  156. ECLLIB=`ecl -eval "(princ (SI:GET-LIBRARY-PATHNAME))" -eval "(quit)"`
  157. insinto "${ECLLIB#${EPREFIX}}"
  158. doins src/binary-ecl/maxima.fas
  159. fi
  160. }
  161. pkg_postinst() {
  162. if use emacs; then
  163. elisp-site-regen
  164. mktexlsr
  165. fi
  166. }
  167. pkg_postrm() {
  168. if use emacs; then
  169. elisp-site-regen
  170. mktexlsr
  171. fi
  172. }