core/sage-mathematics/PKGBUILD
2012-04-26 05:31:30 +00:00

116 lines
3.7 KiB
Bash

#
# Platform Packages for Chakra, part of chakra-project.org
#
# maintainer: Manuel Tortosa <manutortosa[at]chakra-project[dot]org>
pkgname=sage-mathematics
pkgver=4.8
pkgrel=1
pkgdesc='Open Source Mathematics Software, a viable free alternative to Magma, Maple, Mathematica, and Matlab.'
url='http://www.sagemath.org'
arch=('i686' 'x86_64')
license=('GPL')
depends=('atlas-lapack')
makedepends=('gcc-fortran' 'desktop-file-utils' 'texlive-core')
optdepends=('ffmpeg: to show animations' 'imagemagick: to show animations and some LaTeX output in the notebook'
'texlive-core: to view LaTeX output in the notebook and to use SageTeX'
'jsmath-fonts: native TeX fonts for the notebook'
'openssh: to use the notebook in secure mode')
install="$pkgname.install"
source=("http://boxen.math.washington.edu/home/release/sage-$pkgver/sage-$pkgver.tar"
"http://boxen.math.washington.edu/home/leif/Sage/spkgs/gfan-0.4plus.p3.spkg"
"http://boxen.math.washington.edu/home/leif/Sage/spkgs/givaro-3.2.13.rc1.p4.spkg"
'SAGE-notebook.desktop' 'polybori_gcc47.patch')
noextract=("gfan-0.4plus.p3.spkg" "givaro-3.2.13.rc1.p4.spkg")
md5sums=('3e9725846a20f624a9a6811107fc5cb0'
'2e35abd57788571faf6b638802bff470'
'a84996518e39a1197eaf63562d8fe734'
'cc47a29bc32fbdea48f8a19e2ad70441'
'21462df65ca8bc72988022ba572a0753')
build() {
cd sage-$pkgver
# fix gfan build with GCC 4.7 http://trac.sagemath.org/sage_trac/ticket/12760
mv ../gfan-0.4plus.p3.spkg spkg/standard
rm spkg/standard/gfan-0.4plus.p1.spkg
# fix sage library build with GCC 4.7 http://trac.sagemath.org/sage_trac/ticket/12760
mv ../givaro-3.2.13.rc1.p4.spkg spkg/standard
rm spkg/standard/givaro-3.2.13.rc1.p3.spkg
# fix polybori build with GCC 4.7 http://trac.sagemath.org/sage_trac/ticket/12750
cd spkg/standard
tar xjf polybori-0.7.1.p6.spkg
patch -p0 -i $srcdir/polybori_gcc47.patch
tar cjf polybori-0.7.1.p6.spkg polybori-0.7.1.p6
rm -r polybori-0.7.1.p6
cd ../..
# fix missing symbol _ZN23Parma_Polyhedra_Library13have_sse_unitE on i686 http://trac.sagemath.org/sage_trac/ticket/11391
if [[ "$CARCH" == "i686" ]]; then
cd spkg/standard
tar xjf ppl-0.11.2.p0.spkg
sed -i 's/--enable-interfaces=c++/--enable-interfaces="c++ c"/' ppl-0.11.2.p0/spkg-install
tar cjf ppl-0.11.2.p0.spkg ppl-0.11.2.p0
rm -r ppl-0.11.2.p0
cd ../..
fi
unset CFLAGS
unset CXXFLAGS
unset LDFLAGS
# fix polybori, linbox and sage library build with GCC 4.7 http://trac.sagemath.org/sage_trac/ticket/12751
export CXX="g++ -fpermissive"
# parallel build
export MAKE="make -j2"
# use archlinux's fortran
export SAGE_FORTRAN='/usr/bin/gfortran'
export SAGE_FORTRAN_LIB='/usr/lib/libgfortran.so'
# use external ATLAS
[[ $USE_EXTERNAL_ATLAS ]] && export SAGE_ATLAS_LIB='/usr/lib'
# 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'
make
}
check() {
cd sage-$pkgver
make ptest || /bin/true
# uncomment if you want to run all the tests (warning: very long)
# make ptestlong || /bin/true
}
package() {
cd sage-$pkgver
# cp because make install is experimental and will corrupt the install
install -d $pkgdir/opt/sage
cp -r * $pkgdir/opt/sage
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/install.log
# remove source packages
rm -rf $pkgdir/opt/sage/spkg/{base,standard,logs}
}