# $Id: PKGBUILD 100639 2013-11-06 20:15:47Z arcanis $ # Maintainer: Evgeniy Alekseev # Contributor: Daniel Wallace # Contributor: Antonio Rojas # Contributor: Thomas Dziedzic # Contributor: Osman Ugus # Contributor: Stefan Husmann # Special thanks to Nareto for moving the compile from the .install to the PKGBUILD pkgname=sage-mathematics pkgver=5.12 pkgrel=1 pkgdesc="SAGE: Open Source Mathematics Software, a viable free alternative to Magma, Maple, Mathematica, and Matlab" arch=('i686' 'x86_64') url="http://www.sagemath.org" license=('GPL') #depends=('desktop-file-utils' 'java-environment=7' 'libjpeg-turbo' 'libtiff' 'libxmu' 'sqlite' 'xz') makedepends=('gcc-fortran' 'freetype2' 'desktop-file-utils') 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' 'cairo: R plots') source=("http://sage.math.washington.edu/home/release/sage-${pkgver}/sage-${pkgver}.tar" 'fix-atlas.patch' 'Sage-notebook.desktop' 'sage.service') install="${pkgname}.install" md5sums=('21d62a8a61e351c3c124167b3eead46f' '527a621b19dd93941cd018d2c1559f96' '64e0314988ceb2f7dd21da87aa645076' '985da1c1d1dcdc3ea9aa73035cb7996b') prepare() { # fix ATLAS build http://sourceforge.net/p/math-atlas/discussion/75123/thread/dc45bb67/ cd "sage-${pkgver}/spkg/standard" tar xjf atlas-3.10.1.p5.spkg rm atlas-3.10.1.p5.spkg cd atlas-3.10.1.p5 patch -p0 -i "${srcdir}/fix-atlas.patch" cd .. tar cjf atlas-3.10.1.p5.spkg atlas-3.10.1.p5 rm -r atlas-3.10.1.p5 # create DOT_SAGE directory if [[ -d ${srcdir}/build ]]; then rm -rf "${srcdir}/build" fi mkdir "${srcdir}/build" } build() { cd "sage-${pkgver}" # fix "missing sage.all error" during build unset CFLAGS unset CXXFLAGS # fix build errors unset LDFLAGS export MAKE="make -j$(nproc)" # 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="${srcdir}/build" # singular is broken export CPP='/usr/bin/cpp' # only build sage, no documents #make build make ./sage --bdist "${pkgver}" } << COMMENT check() { cd "sage-${pkgver}" make test # uncomment if we want to run all the tests (warning: very long) #make ptestlong } COMMENT 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" # 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" # install a systemd user unit install -Dm755 "${srcdir}/sage.service" "${pkgdir}/usr/lib/systemd/user/sage.service" # install desktop file desktop-file-install "${srcdir}/Sage-notebook.desktop" --dir "${pkgdir}/usr/share/applications" } # vim :set ts=2 sw=2 et: