core/sage-mathematics/PKGBUILD
2013-03-24 00:34:14 +00:00

83 lines
2.5 KiB
Bash

# Maintainer: Manu
pkgname=sage-mathematics
pkgver=5.8
pkgrel=1
pkgdesc='SAGE: Open Source Mathematics Software, a viable free alternative to Magma, Maple, Mathematica, and Matlab.'
url='http://www.sagemath.org'
arch=('x86_64')
license=('GPL')
depends=('desktop-file-utils')
makedepends=('gcc-fortran' )
optdepends=('imagemagick: some plotting functionality benefits from it'
'texlive-core: some plotting functionality benefits from it, also to use SageTeX'
'openssh: to use the notebook in secure mode'
'ffmpeg: to show animations')
options=('!makeflags')
install="${pkgname}.install"
source=("http://sage.math.washington.edu/home/release/sage-${pkgver}/sage-${pkgver}.tar"
'SAGE-notebook.desktop')
md5sums=('b91d6c20798f396a9c875527c78b3587'
'b82f94383829eee26648feb977e2d89b')
build() {
cd sage-${pkgver}
# fix "missing sage.all error" during build
unset CFLAGS
unset CXXFLAGS
# fix build errors
unset LDFLAGS
# enable multiple threads while building, is this really needed? check if uses MAKEFLAGS
export SAGE_BUILD_THREADS=$(lscpu | awk '/^CPU\(s\):/ { print $2 }')
export MAKE="make -j${SAGE_BUILD_THREADS}"
# use archlinux's fortran rather then the one that ships with sage to compile sage's fortran
export FC=/usr/bin/gfortran
# disable building with debugging support
export SAGE_DEBUG='no'
# enable fat binaries (disables processor specific optimizations)
# comment out if you're only building it for yourself
export SAGE_FAT_BINARY='yes'
# can't write to root in a clean chroot
export DOT_SAGE='/build/src/'
# only build sage, no documents
#make build
make
./sage --bdist "$pkgver"
}
package() {
cd sage-${pkgver}
# cp because make install is experimental and will corrupt the install
install -d ${pkgdir}/opt/sage
cp -dpr --no-preserve=ownership dist/sage-"$pkgver-$CARCH-Linux/"* ${pkgdir}/opt/sage/
# move SageTeX files to more appropriate directory
install -d ${pkgdir}/usr/share
mv ${pkgdir}/opt/sage/local/share/texmf \
${pkgdir}/usr/share
desktop-file-install ${srcdir}/SAGE-notebook.desktop \
--dir ${pkgdir}/usr/share/applications
# create link to main binary
install -d ${pkgdir}/usr/bin
ln -s /opt/sage/sage ${pkgdir}/usr/bin/sage
# remove build logs
rm -f ${pkgdir}/opt/sage/*.log
rm -rf ${pkgdir}/opt/sage/spkg/logs
# remove source packages, since they are rarely needed, they are 300mb in size (compressed)
rm -f ${pkgdir}/opt/sage/spkg/base/*spkg
rm -f ${pkgdir}/opt/sage/spkg/standard/*spkg
}