# 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 ~amd64 ~ppc64" 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-2.2.1 >=media-libs/libpng-1.2.22 >=media-libs/freetype-2.3.5 >=sci-libs/gsl-1.10 >=sci-libs/blas-atlas-3.8.0 >=sci-libs/lapack-atlas-3.8.0 >=dev-db/sqlite-3 media-libs/gd =sci-mathematics/maxima-5.13.0-r1" RDEPEND=">=virtual/jre-1.4 ${DEPEND}" # 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} ####################################################### # command to patch spkg - argument is package name # with version number pkg-#p#. The corresponding # patch is called pkg-#p#.patch. ####################################################### spkg_patch() { tar xjf $1.spkg rm $1.spkg epatch $FILESDIR/$1.patch tar cjf $1.spkg $1 rm -rf $1 } pkg_setup() { FORTRAN="gfortran" fortran_pkg_setup ewarn "maxima cannot be called from sage if built with sbcl" ewarn "it works with clisp, cmucl and possibly gcl" ewarn "if you have trouble building clisp look at bug #54738" einfo "Sage itself is released under the GPL-2 _or later_ license" einfo "However sage is distributed with packages having different licenses." einfo "This ebuild unfortunately does too, here is a list of licenses used:" einfo "BSD, LGPL, apache 2.0, PYTHON, MIT, public-domain, ZPL and as-is" } src_unpack() { unpack ${A} cd ${S} echo 'patching in progress' # bypass the sage fortran package alltogether and set sage_fortran # to be gfortran. epatch $FILESDIR/sage-2.10.1-simple.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. cd ${S}/spkg/standard # fix to find external blas atlas. spkg_patch scipy-20071020-0.6.p3 # patching scipy_sandbox # fix to find external blas atlas spkg_patch scipy_sandbox-20071020.p2 # patching cvxopt # forget about f77blas which should be provided by blas spkg_patch 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 }