# Copyright 1999-2004 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit eutils DESCRIPTION="A serial or parallel linear system solver library based on iterative methods." HOMEPAGE="http://www-unix.mcs.anl.gov/petsc/petsc-2/" SRC_URI="ftp://ftp.mcs.anl.gov/pub/petsc/${PN}.tar.gz" LICENSE="TO_DEFINE" SLOT="0" KEYWORDS="~x86" IUSE="mpi X" RDEPEND="mpi? ( sys-cluster/mpich ) !sys-cluster/mpich2 !sys-cluster/lam-mpi virtual/lapack virtual/blas sys-devel/libtool" # need find during install process DEPEND="sys-apps/findutils sys-apps/sed ${RDEPEND}" S1=${WORKDIR}/${P} S=${WORKDIR}/${PN} src_unpack() { unpack ${A} mv ${S1} ${S} cd ${S} #this will help in the configure part. It will be installed in /opt/petsc } petsc_test() { eerror eerror "PETSc test failed." eerror "Do emerge -C petsc" eerror die } src_compile() { use mpi || myconf="--with-mpi=0" use X && myconf="--with-X=1" || myconf="--with-X=0" export PETSC_ARCH="linux_local" || die export PETSC_DIR=${S} || die ./config/configure.py ${myconf} \ --prefix=/opt/ \ -PETSC_ARCH=$PETSC_ARCH \ -PETSC_DIR=$PETSC_DIR \ --with-gcov=1 \ --with-default-language=c \ --with-libtool=1 \ --CFLAGS="-fno-strict-aliasing" \ --CXXFLAGS="-fno-strict-aliasing" \ -CFLAGS_g="-ggdb -ggdb3" \ -CFLAGS_O="$CFLAGS" \ --with-mpi-compiler=0 \ --with-mpi-dir=/usr/ \ --with-matlab=0 || die "PETSc config failed." make BOPT=g all || die make BOPT=O all || die } src_install() { # cd ${S} || die export PETSC_ARCH="linux_local" || die export PETSC_DIR=${S} || die echo $PETSC_DIR || die echo $PETSC_ARCH || die make INSTALL_DIR="${D}/opt/${PN}" install || die make INSTALL_DIR="${D}/opt/${PN}" install_src || die make INSTALL_DIR="${D}/opt/${PN}" install_docs || die # fix the libtool .la files LAOBJS=`find . | grep ".la$"` dosed -i -e "s:${WORKDIR}:/opt:g" ${LAOBJS} # fix broken libtool executable stuff dosed -i -e "s:${SHELL} ${top_builddir}/libtool:`which libtool`:g" bmake/linux_local/variables dosed -i -e "s:/bin/sh /opt/petsc/libtool:`which libtool`:g" bmake/linux_local/petscmachineinfo.h } pkg_preinst() { # replace this with doenvd (doenv?) dodir /etc/env.d echo "PATH=/opt/${PN}/bin" > ${D}/etc/env.d/33${PN} echo "PETSC_DIR=/opt/${PN}" >> ${D}/etc/env.d/33${PN} echo "PETSC_ARCH=linux_local" >> ${D}/etc/env.d/33${PN} } pkg_postinst() { einfo "If it is a binary installation, the tests will not be run." if [ -d ${S} ] ; then cd ${S} export PETSC_ARCH="linux_local" || die export PETSC_DIR=${S} || die make BOPT=g test || petsc_test make BOPT=O test || petsc_test einfo "Running env-update to add the binaries to the PATH and" einfo "to add the PETSC_ARCH and PETSC_DIR variables" einfo "to the environment" /usr/sbin/env-update && source /etc/profile fi #einfo "Need to modify some .la in the library dirs and the bmake/linux_local/petscmachineinfo.h" }