# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ DESCRIPTION="number theory and algebraic geometry software" HOMEPAGE="http://modular.math.washington.edu/sage/" SRC_URI="http://modular.math.washington.edu/sage/dist/src/${P}.tar" inherit eutils flag-o-matic fortran LICENSE="GPL-2" SLOT="0" KEYWORDS="x86 ppc" IUSE="" DEPEND="sys-devel/flex dev-lang/perl || (sys-devel/bison dev-util/yacc) app-arch/bzip2 sys-libs/readline sys-libs/zlib >=net-libs/gnutls-1.6.3 >=media-libs/libpng-1.2.22 >=media-libs/freetype-2.3.5 >=sci-libs/gsl-1.9 >=sci-libs/blas-atlas-3.8.0 >=sci-libs/lapack-atlas-3.8.0 >=dev-db/sqlite-3 media-libs/gd sci-mathematics/maxima" # linbox doesn't configure properly with -Wl,--as-needed so I zap it. filter-ldflags -Wl,--as-needed # lcalc has problem with some optimizations enabled by -march=native on an athlon-4. # Until we can find what exactly is wrong, I filter all -march= setting. # I'll be glad if someone can point to a better way to do it or which which flag to suppress. # The error is : # /scratch/portage/sci-mathematics/sage-2.9.1.1/temp/ccHexhRT.o: In function `__exchange_and_add': # /usr/lib/gcc/i686-pc-linux-gnu/4.2.2/include/g++-v4/ext/atomicity.h:51: undefined reference to `__sync_fetch_and_add_4' # ARCHFLAG=$(get-flag -march) filter-flags ${ARCHFLAG} pkg_setup() { FORTRAN="gfortran" fortran_pkg_setup } src_unpack() { ewarn "maxima cannot be called from sage if built with sbcl" ewarn "it works with clisp, cmucl and possibly gcl" unpack ${A} cd ${S} echo 'patching in progress' # bypass the sage fortran package alltogether and set sage_fortran # to be gfortran. epatch $FILESDIR/prereq.patch cp $FILESDIR/which_fortran ${S}/spkg/base/ cp $FILESDIR/sage_fortran ${S}/spkg/base/ # change the deps file to only build what we want to be internal. epatch $FILESDIR/deps.patch cd ${S}/spkg/standard ################################################################### # comment as I reverted to using internal gmp/mpfr because # problems from a sage-gmp patch. ################################################################### # patching mpfi spkg # fix spkg-install so mpfi can be find external gmp and mpfr # tar xfj mpfi-1.3.4-cvs20071125.p2.spkg # rm mpfi-1.3.4-cvs20071125.p2.spkg # epatch $FILESDIR/mpfi-build.patch # tar cjf mpfi-1.3.4-cvs20071125.p2.spkg mpfi-1.3.4-cvs20071125.p2 # rm -rf mpfi-1.3.4-cvs20071125.p2 # patching genus2reduction spkg # fix the header from pari.h to pari/pari.h and the compiler options # accordingly #################################################################### # Switch back to internal pari until gentoo provides the # newest version and includes gallois data. #################################################################### # tar xfj genus2reduction-0.3.spkg # rm genus2reduction-0.3.spkg # epatch $FILESDIR/genus2reduction-spkg.patch # epatch $FILESDIR/genus2reduction.patch # tar cjf genus2reduction-0.3.spkg genus2reduction-0.3 # rm -rf genus2reduction-0.3 # patching lcalc # Another pari header fix (2 files) and adjust the makefile # tar xjf lcalc-20070107.p0.spkg # rm lcalc-20070107.p0.spkg # epatch $FILESDIR/lcalc.patch # tar cjf lcalc-20070107.p0.spkg lcalc-20070107.p0 # rm -rf lcalc-20070107.p0 # patching scipy # fix to find external blas atlas. tar xjf scipy-20071020-0.6.p2.spkg rm scipy-20071020-0.6.p2.spkg epatch $FILESDIR/scipy.patch tar cjf scipy-20071020-0.6.p2.spkg scipy-20071020-0.6.p2 rm -rf scipy-20071020-0.6.p2 # patching scipy_sandbox # fix to find external blas atlas. tar xjf scipy_sandbox-20071020.spkg rm scipy_sandbox-20071020.spkg epatch $FILESDIR/scipy_sandbox.patch tar cjf scipy_sandbox-20071020.spkg scipy_sandbox-20071020 rm -rf scipy_sandbox-20071020 # patching cvxopt # forget about f77blas which should be provided by blas # [equivalent of Gentoo blas-reference but providing f77blas] tar xjf cvxopt-0.9.p5.spkg rm cvxopt-0.9.p5.spkg epatch $FILESDIR/cvxopt.patch tar cjf cvxopt-0.9.p5.spkg cvxopt-0.9.p5 rm -rf cvxopt-0.9.p5 echo 'patching done' } src_compile() { emake || die "make failed" if ( grep "sage: An error occurred" ${S}/install.log ); then die "make failed" fi } src_install() { make DESTDIR="${D}/opt" install sed -i "s/SAGE_ROOT=.*\/opt/SAGE_ROOT=\"\/opt/" "${D}/opt/bin/sage" "${D}/opt/sage/sage" } src_postinstall(){ # make sure file are correctly setup in the new location by running # sage as root. This prevent nasty message to be presented to the user. sage -v }