| 1 |
# Copyright 1999-2011 Gentoo Foundation |
| 2 |
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
# $Header: /var/cvsroot/gentoo-x86/sci-mathematics/fricas/fricas-1.1.5.ebuild,v 1.1 2011/12/17 05:21:26 grozin Exp $ |
| 4 |
EAPI=2 |
| 5 |
inherit multilib elisp-common |
| 6 |
|
| 7 |
DESCRIPTION="FriCAS is a fork of Axiom computer algebra system" |
| 8 |
HOMEPAGE="http://${PN}.sourceforge.net/" |
| 9 |
SRC_URI="mirror://sourceforge/${PN}/${P}-full.tar.bz2" |
| 10 |
LICENSE="BSD-2" |
| 11 |
SLOT="0" |
| 12 |
KEYWORDS="~amd64 ~x86" |
| 13 |
|
| 14 |
# Supported lisps, number 0 is the default |
| 15 |
LISPS=( sbcl cmucl gcl ecl clisp clozurecl ) |
| 16 |
# . means just dev-lisp/${LISP}; foo-x.y.z means >=dev-lisp/foo-x.y.z |
| 17 |
DEPS=( . cmucl-20b . ecls-9 . . ) |
| 18 |
# command name: . means just ${LISP} |
| 19 |
COMS=( . lisp . . . ccl ) |
| 20 |
|
| 21 |
IUSE="${LISPS[*]} X emacs gmp" |
| 22 |
RDEPEND="X? ( x11-libs/libXpm x11-libs/libICE ) |
| 23 |
emacs? ( virtual/emacs ) |
| 24 |
gmp? ( dev-libs/gmp )" |
| 25 |
|
| 26 |
# Generating lisp deps |
| 27 |
n=${#LISPS[*]} |
| 28 |
for ((n--; n > 0; n--)); do |
| 29 |
LISP=${LISPS[$n]} |
| 30 |
DEP=${DEPS[$n]} |
| 31 |
if [ "${DEP}" = "." ]; then |
| 32 |
DEP="dev-lisp/${LISP}" |
| 33 |
else |
| 34 |
DEP=">=dev-lisp/${DEP}" |
| 35 |
fi |
| 36 |
RDEPEND="${RDEPEND} ${LISP}? ( ${DEP} ) !${LISP}? (" |
| 37 |
done |
| 38 |
RDEPEND="${RDEPEND} dev-lisp/${LISPS[0]}" |
| 39 |
n=${#LISPS[*]} |
| 40 |
for ((n--; n > 0; n--)); do |
| 41 |
RDEPEND="${RDEPEND} )" |
| 42 |
done |
| 43 |
|
| 44 |
DEPEND="${RDEPEND}" |
| 45 |
|
| 46 |
# necessary for clisp and gcl |
| 47 |
RESTRICT="strip" |
| 48 |
|
| 49 |
src_configure() { |
| 50 |
local LISP n |
| 51 |
LISP=sbcl |
| 52 |
n=${#LISPS[*]} |
| 53 |
for ((n--; n > 0; n--)); do |
| 54 |
if use ${LISPS[$n]}; then |
| 55 |
LISP=${COMS[$n]} |
| 56 |
if [ "${LISP}" = "." ]; then |
| 57 |
LISP=${LISPS[$n]} |
| 58 |
fi |
| 59 |
fi |
| 60 |
done |
| 61 |
einfo "Using lisp: ${LISP}" |
| 62 |
|
| 63 |
# aldor is not yet in portage |
| 64 |
econf --disable-aldor --with-lisp=${LISP} $(use_with X x) $(use_with gmp) |
| 65 |
} |
| 66 |
|
| 67 |
src_compile() { |
| 68 |
# bug #300132 |
| 69 |
emake -j1 || die "emake failed" |
| 70 |
} |
| 71 |
|
| 72 |
src_test() { |
| 73 |
emake -j1 all-input |
| 74 |
} |
| 75 |
|
| 76 |
src_install() { |
| 77 |
emake -j1 DESTDIR="${D}" install || die 'emake install failed' |
| 78 |
dodoc README FAQ || die "dodoc failed" |
| 79 |
|
| 80 |
if use emacs; then |
| 81 |
sed -e "s|(setq load-path (cons (quote \"/usr/$(get_libdir)/fricas/emacs\") load-path)) ||" \ |
| 82 |
-i "${D}"/usr/bin/efricas \ |
| 83 |
|| die "sed efricas failed" |
| 84 |
elisp-install ${PN} "${D}"/usr/$(get_libdir)/${PN}/emacs/*.el |
| 85 |
elisp-site-file-install "${FILESDIR}"/64${PN}-gentoo.el |
| 86 |
else |
| 87 |
rm "${D}"/usr/bin/efricas || die "rm efricas failed" |
| 88 |
fi |
| 89 |
rm -r "${D}"/usr/$(get_libdir)/${PN}/emacs || die "rm -r emacs failed" |
| 90 |
} |
| 91 |
|
| 92 |
pkg_postinst() { |
| 93 |
use emacs && elisp-site-regen |
| 94 |
} |
| 95 |
|
| 96 |
pkg_postrm() { |
| 97 |
use emacs && elisp-site-regen |
| 98 |
} |