Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Ebuild for Risa/Asir
# Copyright 2017 Kazuki Maeda <kmaeda@kmaeda.net>
# Distributed under the terms of the Simplified BSD License
EAPI=6
inherit multilib
DESCRIPTION="Risa/Asir is an open source general computer algebra system."
HOMEPAGE="http://www.math.kobe-u.ac.jp/Asir/"
MY_P="openxm-head.tar.gz"
SRC_URI="http://www.math.sci.kobe-u.ac.jp/pub/OpenXM/Head/${MY_P}"
RESTRICT="primaryuri"
LICENSE="" # Fujitsu Research Laboratory Risa/Asir license
SLOT="0"
KEYWORDS="~x86 ~amd64"
# Use flags:
# - contrib: install asir-contrib
# - emacs: install asir-mode.el
# - pari: enable PARI extensions (but could not compile on Jan, 2017; why?)
IUSE="contrib emacs pari"
RDEPEND="dev-libs/gmp
dev-libs/mpfr
dev-libs/mpc
emacs? ( virtual/emacs )
pari? ( sci-mathematics/pari )"
DEPEND="${DEPEND}
app-arch/sharutils
dev-libs/boehm-gc[static-libs]"
S=${WORKDIR}/OpenXM_contrib2/asir2000
S_CONTRIB=${WORKDIR}/OpenXM/src/asir-contrib
S_EL=${WORKDIR}/OpenXM_contrib2/windows/post-msg-asirgui
SITELISP=/usr/share/emacs/site-lisp
pkg_setup() {
echo ""
ewarn "The source tarball ${MY_P} may be updated."
ewarn "If you want to install the latest version, once remove"
ewarn "${MY_P} in your DISTDIR and run emerge with"
ewarn "--digest option."
echo ""
sleep 3
return
}
src_configure() {
econf --without-asir-gc $(use_with pari)
if use contrib ; then
cd ${S_CONTRIB}
econf --prefix=${D}/usr/$(get_libdir)
fi
}
src_install() {
emake DESTDIR="${D}" install install-lib install-libasir install-doc
if use contrib ; then
cd ${S_CONTRIB}
emake install
cd ${D}/usr/$(get_libdir)/lib
mv asir-contrib ../
rmdir ${D}/usr/$(get_libdir)/lib
fi
if use emacs ; then
install -m 755 -d ${D}${SITELISP}
install -m 644 ${S_EL}/asir-mode.el ${D}${SITELISP}
fi
}
pkg_postinst() {
ALP="/usr/$(get_libdir)/asir"
if use contrib ; then
ALP="${ALP}:/usr/$(get_libdir)/asir-contrib"
fi
ewarn "You must set the environment variable ASIRLOADPATH."
ewarn "If you are using bash, run"
ewarn ""
ewarn " echo \"export ASIRLOADPATH=${ALP}\" >> ~/.bashrc"
ewarn ""
if use emacs ; then
einfo "To use asir-mode in Emacs, write the following configuration to"
einfo "~/.emacs.d/init.el:"
einfo ""
einfo "(setq auto-mode-alist (cons '(\"\\\\\\\\.rr$\" . asir-mode) auto-mode-alist))"
einfo "(autoload 'asir-mode \"asir-mode\" \"Asir mode\" t)"
einfo ""
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment