# Maintainer: Antonio Rojas # Contributor: Evgeniy Alekseev # Contributor: Daniel Wallace # Contributor: Thomas Dziedzic # Contributor: Osman Ugus # Contributor: Stefan Husmann pkgbase=sagemath-git pkgname=(sagemath-git sagemath-jupyter-git) pkgver=8.5.r0.g934b744f65 pkgrel=1 pkgdesc="Open Source Mathematics Software, free alternative to Magma, Maple, Mathematica, and Matlab" arch=(x86_64) url="http://www.sagemath.org" license=(GPL) depends=(ipython2 ppl palp brial cliquer maxima-ecl gfan sympow nauty python2-rpy2 python2-fpylll python2-psutil python2-cypari2 python2-matplotlib python2-scipy python2-sympy python2-networkx python2-pillow python2-future gap flintqs lcalc lrcalc arb eclib gmp-ecm zn_poly gd python2-cvxopt pynac linbox m4rie rubiks pari-galdata pari-seadata-small planarity rankwidth tachyon sage-data-combinatorial_designs sage-data-elliptic_curves sage-data-graphs sage-data-polytopes_db sage-data-conway_polynomials libgiac libhomfly libbraiding three.js openblas) optdepends=('cython2: to compile cython code' 'python2-pkgconfig: to compile cython code' 'jmol: 3D plots' 'sage-notebook: Flask notebook interface (deprecated)' 'sagemath-doc: Documentation and inline help' 'python2-igraph: igraph backend for graph theory' 'coin-or-cbc: COIN backend for numerical computations' 'coin-or-csdp: for computing Lovász theta-function of graphs' 'buckygen: for generating fullerene graphs' 'plantri: for generating some classes of graphs' 'benzene: for generating fusenes and benzenoids' 'ffmpeg: to export animations to video' 'imagemagick: to show animations' 'coxeter: Coxeter groups implementation' 'lrs: Algorithms for linear reverse search used in game theory and for computing volume of polytopes' 'libfes: exhaustive search of solutions for boolean equations' 'python2-pynormaliz: Normaliz backend for polyhedral computations' 'latte-integrale: integral point count in polyhedra' 'polymake: polymake backend for polyhedral computations' 'shared_meataxe: faster matrix arithmetic over finite fields' 'sirocco: for computing the fundamental group of the complement of a plane curve' 'primecount: faster prime_pi implementation' 'dot2tex: for displaying some diagrams' 'cryptominisat5: SAT solver' 'python2-pycosat: picosat SAT solver' 'python2-pip: to install optional packages with sage -pip') makedepends=(cython2 boost ratpoints symmetrica python2-jinja coin-or-cbc sirocco mcqd coxeter bliss-graphs tdlib python2-pkgconfig shared_meataxe libfes primecount git) source=(git://git.sagemath.org/sage.git#branch=develop sagemath-env.patch package.patch latte-count.patch sagemath-python3-notebook.patch test-optional.patch fes02.patch sagemath-threejs.patch sagemath-cremona.patch sagemath-gap-4.10.patch sagemath-sphinx-1.8.patch sagemath-networkx-2.2.patch sagemath-cypari2.patch sagemath-singular-4.1.1.p4.patch sagemath-ecl-sigfpe.patch) sha256sums=('SKIP' 'f26ab0f22d7d916a621f02b9d9fc806eb6825f8d34cdf45accb0e2601c82f049' '960afe4fcbffe2762b66119b8f14355386ced0d8ee52b535d0dac1dba90d365b' 'ef265f88ceb6caf4aac2d86ea74850861d99a63d11c94fc52b2ce88053c26d1e' 'bd2744c6564bbf71bd6ea3cd7b9031e2126cc1423bcdc1fcc258d90d750a129d' 'f12bd2a53ad51549015093aacc89978f4d796d9ab5bcd3d737aa0d57a5815b54' '7fcb52e96935dccb0f958d37c2f4e3918392480b9af53e08562f6cba6c68cb94' 'f6b48abf34f64ea3fc092b0f0179e89633f7d3ecc0d62c2acacbfa1217751d63' '4c6df9e4e5a7b29ecf6189eda3e5a79f69b6e1b4d29c1b9559663149b8c0af96' '224f8d1db783d7ae25408912c4891687d6a8a1dacc8c5b3a00b725a28d951b6c' '22f5e44a42c8276025b8512f45cac1c36d576c29c7fd9d36fde8b19ff87867d8' 'c19afd209d1f0caf072a43e0f6447c61cae8cf1583f3f89e27c48c8302542c26' '1677bcaa3fe19bf978b6ffaae7b64b7ec32df63fa3d0e28b179cfa831fcfa896' '482887fe43d89cef3270e89300ab9e2238fa74cd5b7c875688b68fb1b10c4fdf' '87bf055de0a233e9599c59a86f64b4502be31fda53ba0a426f94f25f17ca76df') pkgver() { cd sage git describe --long --tags | sed -r 's/([^-]*-g)/r\1/;s/-/./g' } prepare(){ cd sage # Arch-specific patches # assume all optional packages are installed patch -p0 -i ../package.patch # set env variables patch -p0 -i ../sagemath-env.patch # don't list optional packages when running tests patch -p0 -i ../test-optional.patch # use correct latte-count binary name patch -p1 -i ../latte-count.patch # make 'sage -notebook=jupyter' work with our python3 jupyter-notebook package patch -p1 -i ../sagemath-python3-notebook.patch # fix three.js plotting backend patch -p1 -i ../sagemath-threejs.patch # fix introspection with sphinx 1.8 patch -p1 -i ../sagemath-sphinx-1.8.patch # Upstream patches # fix build against libfes 0.2 http://trac.sagemath.org/ticket/15209 patch -p1 -i ../fes02.patch # use Features to detect Cremona databases https://trac.sagemath.org/ticket/25825 patch -p1 -i ../sagemath-cremona.patch # Fix graph generators with networkx 2.2 https://trac.sagemath.org/ticket/26326 patch -p1 -i ../sagemath-networkx-2.2.patch # Fix build with cypari 2.0 https://trac.sagemath.org/ticket/26442 patch -p1 -i ../sagemath-cypari2.patch # Build with GAP 4.10 https://trac.sagemath.org/ticket/22626 patch -p1 -i ../sagemath-gap-4.10.patch # Fixes for singular 4.1.1p4 https://trac.sagemath.org/ticket/25993 patch -p1 -i ../sagemath-singular-4.1.1.p4.patch # Fix SIGFPE crashes with ecl 16.1.3 https://trac.sagemath.org/ticket/22191 patch -p1 -i ../sagemath-ecl-sigfpe.patch # use python2 sed -e 's|sage-python23|python2|' -e 's|#!/usr/bin/env python\b|#!/usr/bin/env python2|' -i src/bin/* sed -e 's|cython {OPT}|cython2 {OPT}|' -e 's|python setup.py|python2 setup.py|' -i src/sage/misc/cython.py sed -e 's|exec ipython\b|exec ipython2|' -e 's|cygdb|cygdb2|g' -i src/bin/sage sed -e "s|'cython'|'cython2'|" -i src/bin/sage-cython } build() { cd sage/src export CC=gcc export SAGE_ROOT="$PWD" export SAGE_SRC="$PWD" python2 setup.py build } package_sagemath-git() { optdepends+=('sagemath-jupyter: Jupyter kernel') conflicts=(sagemath) provides=(sagemath) cd sage/src export SAGE_ROOT="$PWD" export SAGE_LOCAL="/usr" export SAGE_EXTCODE="$PWD"/ext python2 setup.py install --root="$pkgdir" --optimize=1 mkdir -p "$pkgdir"/usr/bin cp bin/{sage,math-readline} "$pkgdir"/usr/bin for _i in cachegrind callgrind cleaner coverage coverageall cython env eval grep grepdoc inline-fortran ipynb2rst \ 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 done mkdir -p "$pkgdir"/usr/share/sage cp -r ext "$pkgdir"/usr/share/sage # Remove sage_setup rm -r "$pkgdir"/usr/lib/python2.7/site-packages/sage_setup # Split jupyter kernel rm -r "$pkgdir"/usr/share/jupyter } package_sagemath-jupyter-git() { pkgdesc='Jupyter kernel for SageMath' depends=(sagemath python2-jupyter_client python2-ipywidgets mathjax jsmol) optdepends=('sage-notebook-exporter: convert flask notebooks to Jupyter') cd sage/src export SAGE_ROOT="$PWD" export SAGE_LOCAL="/usr" python2 -c "from sage.repl.ipython_kernel.install import SageKernelSpec; SageKernelSpec.update(prefix='$pkgdir/usr')" # fix symlinks to assets for _i in $(ls ext/notebook-ipython); do rm "$pkgdir"/usr/share/jupyter/kernels/sagemath/$_i ln -s /usr/share/sage/ext/notebook-ipython/$_i "$pkgdir"/usr/share/jupyter/kernels/sagemath/ done }