# Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/sci-chemistry/gromacs/gromacs-3.3.ebuild,v 1.1 2005/10/14 00:44:11 spyderous Exp $ inherit eutils fortran IUSE="altivec mpi 3dnow sse double-precision" DESCRIPTION="The ultimate molecular dynamics simulation package" SRC_URI="ftp://ftp.gromacs.org/pub/${PN}/${P}.tar.gz" HOMEPAGE="http://www.gromacs.org/" LICENSE="GPL-2" SLOT="0" KEYWORDS="~x86 ~amd64 ~ppc64" #mpi is a local USE flag now #May become official when situation with mpich is cleared (now the only mpi implementation awailable is lam-mpi) DEPEND=">=sci-libs/fftw-3 mpi? ( sys-cluster/lam-mpi ) app-shells/tcsh" src_unpack() { unpack ${A} || die "unpack failed" cd ${WORKDIR} mv ${P} ${P}-single if use double-precision; then cp -pPR ${P}-single ${P}-double fi if use mpi; then cp -pPR ${P}-single ${P}-mpi-single if use double-precision; then cp -pPR ${P}-single ${P}-mpi-double fi fi } src_compile() { local myconf="--libdir=/usr/lib" case "${ARCH}" in x86) if (use 3dnow || use sse); then if use 3dnow; then myconf="${myconf} --enable-ia32-3dnow" fi if use sse; then myconf="${myconf} --enable-ia32-sse" fi else FORTRAN="g77" fortran_pkg_setup myconf="${myconf} --enable-fortran" fi ;; amd64) # all amd64 cpus can run sse code. maybe we should enable this by default? myconf="${myconf} --enable-x86-64-sse" ;; ppc64) if use altivec; then myconf="${myconf} --enable-ppc-altivec" else FORTRAN="g77" fortran_pkg_setup myconf="${myconf} --enable-fortran" fi ;; # ia64) # myconf="${myconf} --enable-ia64-asm" # ;; *) FORTRAN="g77" fortran_pkg_setup myconf="${myconf} --enable-fortran" ;; esac #build single precision package cd ${WORKDIR}/${P}-single econf ${myconf} || die "configure of single precision package failed" emake || die "make of single precision package failed" #build double precision package #defaults to suffix _d if use double-precision; then cd ${WORKDIR}/${P}-double econf ${myconf} \ --enable-double || die "configure of double precision package failed" emake || die "make of double precision package failed" fi #build optional mpi support for mdrun #binary will be mdrun_mpi if use mpi; then cd ${WORKDIR}/${P}-mpi-single econf ${myconf} \ --enable-mpi \ --program-suffix=_mpi || die "configure of mpi enabled mdrun failed" emake mdrun || die "make of mpi enabled mdrun failed" #build optional mpi support for double precision mdrun #binary will be mdrun_mpi_d if use double-precision; then cd ${WORKDIR}/${P}-mpi-double econf ${myconf} \ --enable-mpi \ --enable-double \ --program-suffix=_mpi_d || die "configure of double precision mpi enabled mdrun failed" emake mdrun || die "make of double precision mpi enabled mdrun failed" fi fi } src_install () { cd ${WORKDIR}/${P}-single make DESTDIR=${D} install || die "make install of single precision package failed" # Install documentation. dodoc AUTHORS COPYING INSTALL README #move html docs under /usr/share/doc mv ${D}/usr/share/gromacs/html ${D}/usr/share/doc/${PF}/ if use double-precision; then cd ${WORKDIR}/${P}-double make DESTDIR=${D} install || die "make install of double precision package failed" fi if use mpi; then cd ${WORKDIR}/${P}-mpi-single make DESTDIR=${D} install-mdrun || die "make install of single precision mpi enabled mdrun failed" if use double-precision; then cd ${WORKDIR}/${P}-double make DESTDIR=${D} install-mdrun || die "make install of double precision mpi enabled mdrun failed" fi fi } pkg_postinst() { if use mpi; then einfo "For parallel runs use mdrun_mpi." fi if use double-precision; then einfo "For double precision use suffix _d for executables." fi }