core/sage-mathematics/PKGBUILD

159 lines
6.7 KiB
Bash
Raw Normal View History

2015-04-13 15:59:57 +08:00
# $Id: PKGBUILD 118896 2014-09-13 07:12:02Z arcanis $
# Maintainer: Evgeniy Alekseev <arcanis.arch at gmail dot com>
# Contributor: Daniel Wallace <danielwallace at gtmanfred dot com>
# Contributor: Antonio Rojas <arojas@archlinux.org>
# Contributor: Thomas Dziedzic <gostrc at gmail dot com>
# Contributor: Osman Ugus <ugus11 at yahoo dot com>
# Contributor: Stefan Husmann <stefan-husmann at t-online dot de>
# Special thanks to Nareto for moving the compile from the .install to the PKGBUILD
pkgname=sage-mathematics
2015-04-13 15:59:57 +08:00
pkgver=6.5
pkgrel=3
pkgdesc="Open Source Mathematics Software, free alternative to Magma, Maple, Mathematica, and Matlab"
arch=('i686' 'x86_64')
url="http://www.sagemath.org"
license=('GPL')
2015-04-13 15:59:57 +08:00
depends=('ipython2' 'ppl' 'glpk' 'mpfi' 'palp' 'polybori' 'singular' 'libcliquer' 'maxima-ecl' 'gfan' 'sympow' 'tachyon' 'python2-rpy2'
'python2-matplotlib' 'python2-scipy' 'python2-sympy' 'python2-networkx' 'libgap' 'gap' 'flintqs' 'lcalc' 'lrcalc'
'eclib' 'gmp-ecm' 'zn_poly' 'python2-gd' 'python2-cvxopt' 'pynac' 'linbox' 'gsl' 'rubiks' 'pari-galdata' 'pari-seadata-small'
'sage-data-combinatorial_designs' 'sage-data-elliptic_curves' 'sage-data-graphs' 'sage-data-polytopes_db' 'sage-data-conway_polynomials')
optdepends=('cython2: to compile cython code' 'jmol: 3D plots' 'sage-notebook: Browser-based (flask) notebook interface'
'sage-mathematics-doc: Documentation and inline help' 'sage-mathematics-src: source files needed to build cython code'
'ipython2-notebook: IPython notebook interface' 'mathjax: IPython notebook interface'
'coin-or-cbc: COIN backend for numerical computations' 'nauty: for generating some classes of graphs'
'buckygen: for generating fullerene graphs' 'plantri: for generating some classes of graphs' 'benzene: for generating fusenes and benzenoids'
'libfes: exhaustive search of solutions for boolean polynomial systems'
'lrs: Algorithms for linear reverse search used in game theory and for computing volume of polytopes'
'coxeter3: Coxeter groups implementation' 'cryptominisat: SAT solver')
makedepends=('cython2' 'boost' 'scons' 'ratpoints' 'symmetrica' 'fflas-ffpack' 'python2-jinja' 'coin-or-cbc' 'mcqd' 'libfes' 'coxeter3'
'cryptominisat')
source=("$pkgname-$pkgver.tar.gz::https://github.com/sagemath/sage/archive/$pkgver.tar.gz" "http://www.sagemath.org/packages/upstream/pexpect/pexpect-2.0.tar.bz2"
'anal.h' 'package.patch' 'c_lib.patch' 'env.patch' 'paths.patch' 'clean.patch' 'skip-check.patch'
'pexpect-env.patch' 'pexpect-del.patch' 'fes02.patch' 'tests_parallel.patch' 'ipython3.patch')
md5sums=('5a173b1ecce89c845626653cfb3d199f'
'd9a3e113ed147dcee8f89962a8dccd43'
'a906a180d198186a39820b0a2f9a9c63'
'0eb5ac1537aac93bd67a2925c0cfd84d'
'5216dbb3d80cecc8ec4a36cc9706f8b5'
'563bc42699116d71ca6b06b9f149304e'
'acc25f13728517badafa70d220ab7b8e'
'46c212a3a6713b0f78c370c7186d0982'
'5947a420a0b1483f0cbc74c76895789b'
'a83a3b1bc7fcb7cbf752a83a8311fc42'
'f333939ea6c41377b66407c81016cee4'
'506944613082ba7f5b34360939ca90eb'
'f65910f4644cfe892d95e401ffb85fb6'
'05eaaaf764cc5813120feadbe197e0a0')
# changelog=ChangeLog
prepare(){
cd sage-$pkgver
# Arch-specific patches
# assume all optional packages are installed
patch -p0 -i "$srcdir"/package.patch
# don't assume Sage is already available (Fedora)
patch -p0 -i "$srcdir"/c_lib.patch
# find L.h header
sed -e 's|libLfunction|Lfunction|' -i src/module_list.py
# don't try to link against libpng 1.2
sed -e 's|png12|png|' -i src/module_list.py
# set env variables
patch -p0 -i "$srcdir"/env.patch
# fix paths in python imports
patch -p0 -i "$srcdir"/paths.patch
# fix cython linking
sed -e "s| atlas(),||" -i src/sage/misc/cython.py
# don't try to remove installed files
patch -p0 -i "$srcdir"/clean.patch
# skip checking build status
patch -p0 -i "$srcdir"/skip-check.patch
# supress warning about GAP install dir
sed -e "s|gapdir = os.path.join(SAGE_LOCAL, 'gap', 'latest')|gapdir = '/usr/lib/gap'|" -i src/sage/libs/gap/util.pyx
# fix Cremona database detection
sed -e "s|is_package_installed('database_cremona_ellcurve')|os.path.exists('/usr/share/sage/cremona/cremona.db')|" \
-i src/sage/databases/cremona.py
# Upstream patches
# fix build against libfes 0.2 http://trac.sagemath.org/ticket/15209
patch -p0 -i "$srcdir"/fes02.patch
# remove missing cython source - fixes build with cython 0.22 http://trac.sagemath.org/ticket/17657
patch -p0 -i "$srcdir"/tests_parallel.patch
# port to IPython 3
patch -p1 -i "$srcdir"/ipython3.patch
# fix IPython kernel path
sed -e "s|os.path.join(SAGE_ROOT, 'sage')|'/usr/bin/sage'|" -i src/sage/repl/ipython_kernel/install.py
# use python2
sed -e 's|#!/usr/bin/env python|#!/usr/bin/env python2|' -e 's|exec python|exec python2|' -i src/bin/*
sed -e 's|cython %s %s|cython2 %s %s|' -e 's|python setup.py|python2 setup.py|' -i src/sage/misc/cython.py
sed -e 's|exec ipython|exec ipython2|' -e 's|cygdb|cygdb2|' -i src/bin/sage
sed -e "s|'cython'|'cython2'|" -i src/bin/sage-cython
# copy required private PARI header
mkdir -p src/pari
cp $srcdir/anal.h src/pari/anal.h
cd $srcdir/pexpect-2.0
# fix env in pexpect
patch -p1 -i "$srcdir"/pexpect-env.patch
# hide exceptions in pexpect
patch -p1 -i "$srcdir"/pexpect-del.patch
2014-10-09 03:04:21 +08:00
}
2015-04-13 15:59:57 +08:00
2012-04-26 13:31:30 +08:00
build() {
2015-04-13 15:59:57 +08:00
cd sage-$pkgver/src
export SAGE_LOCAL="/usr"
export SAGE_SRC="$PWD"
pushd c_lib
CXX=g++ UNAME=Linux SAGE64=auto scons
popd
python2 setup.py build
# build pexpect
pushd $srcdir/pexpect-2.0
python2 setup.py build
popd
}
2015-04-13 15:59:57 +08:00
package() {
2015-04-13 15:59:57 +08:00
cd sage-$pkgver/src
2015-04-13 15:59:57 +08:00
export SAGE_ROOT="/usr"
export SAGE_LOCAL="$SAGE_ROOT"
export SAGE_SRC="$PWD"
python2 setup.py install --root="$pkgdir" --optimize=1
mkdir -p "$pkgdir"/usr/{bin,lib}
cp c_lib/libcsage.so "$pkgdir"/usr/lib
cp bin/sage "$pkgdir"/usr/bin
for _i in arch-env banner cachegrind callgrind cleaner coverage coverageall CSI CSI-helper.py cython env eval grep grepdoc inline-fortran ipython \
massif maxima.lisp native-execute notebook num-threads.py omega open preparse python rst2sws rst2txt run run-cython runtests startuptime.py \
sws2rst valgrind version.sh
do
cp bin/sage-$_i "$pkgdir"/usr/bin
2014-10-09 03:04:21 +08:00
done
2015-04-13 15:59:57 +08:00
mkdir -p "$pkgdir"/usr/share/sage
cp -r ext "$pkgdir"/usr/share/sage
# Create SAGE_SRC, needed for the notebook
mkdir "$pkgdir"/usr/share/sage/src
# Install gprc.expect in SAGE_ETC
install -Dm644 ../build/pkgs/pari/gprc.expect "$pkgdir"/etc/sage/gprc.expect
# Install Sage's own pexpect
cd "$srcdir"/pexpect-2.0
python2 setup.py install --root="$pkgdir" --optimize=1
mkdir -p "$pkgdir"/usr/lib/sage/site-packages/
mv "$pkgdir"/usr/lib/python2.7/site-packages/pexpect* "$pkgdir"/usr/lib/sage/site-packages/
}