Skip to content

Instantly share code, notes, and snippets.

@kmaed
Last active September 12, 2021 21:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kmaed/cd7d34573ec341be6bbb3df3b5710495 to your computer and use it in GitHub Desktop.
Save kmaed/cd7d34573ec341be6bbb3df3b5710495 to your computer and use it in GitHub Desktop.
Ebuild for Risa/Asir
# Copyright 2017-2021 Kazuki Maeda <kmaeda@kmaeda.net>
# Distributed under the terms of the Simplified BSD License
EAPI=8
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://air.s.kanazawa-u.ac.jp/~ohara/openxm/${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
IUSE="contrib emacs"
RDEPEND="dev-libs/gmp
dev-libs/mpfr
dev-libs/mpc
sci-libs/mpfi
emacs? ( virtual/emacs )"
DEPEND="${DEPEND}
app-arch/sharutils
dev-libs/boehm-gc[static-libs]
net-libs/libtirpc"
S=${WORKDIR}/OpenXM_contrib2/asir2018
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() {
CFLAGS="-I/usr/include/tirpc ${CFLAGS}"
econf --without-asir-gc --enable-static --enable-plot
if use contrib ; then
cd ${S_CONTRIB}
econf --prefix=${D}/usr/$(get_libdir)
fi
}
src_install() {
emake DESTDIR="${D}" install
mv ${D}/usr/lib/asir ${D}/usr/$(get_libdir)/
rmdir ${D}/usr/lib
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