# Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ EAPI=4 inherit eutils DESCRIPTION="NWChem: Delivering High-Performance Computational Chemistry to Science" HOMEPAGE="http://www.nwchem-sw.org/index.php/Main_Page" SRC_URI="http://www.nwchem-sw.org/images/Nwchem-${PV}.tar.gz" LICENSE="ECL 2.0" SLOT="0" KEYWORDS="~x86 ~amd64" IUSE="mpi doc python" RDEPEND=" python? ( dev-lang/python ) sys-fs/sysfsutils " DEPEND="${RDEPEND} virtual/fortran >=sys-devel/make-3.71 mpi? ( sys-cluster/mpich2[fortran,fortran90] ) " src_unpack() { unpack ${A} cd "${S}" epatch "${FILESDIR}"/nwchem-${PV}-makefile.patch epatch "${FILESDIR}"/nwchem-${PV}-nwchemrc.patch epatch "${FILESDIR}"/nwchem-${PV}-adjust-dir-length.patch if use doc ; then epatch "${FILESDIR}"/nwchem-${PV}-nonstopdoc.patch fi if use python ; then epatch "${FILESDIR}"/nwchem-${PV}-python_makefile.patch fi } src_compile() { PROOF_MPICH2=$(emerge -s mpich2|grep installed|awk '{ print $4 }'|awk -F_ '{ print $1 }'|awk -F. '{ print $2 }') export USE_SUBGROUPS=yes if use mpi ; then export MSG_COMMS=MPI export USE_MPI=yes export MPI_LOC=/usr export MPI_INCLUDE=$MPI_LOC/include export MPI_LIB=$MPI_LOC/lib if [ "$PROOF_MPICH2" = "2" ]; then export LIBMPI="-lfmpich -lmpich -lpthread" # MPICH2 1.2 elif [ "$PROOF_MPICH2" = "3" ] || [ "$PROOF_MPICH2" = "4" ]; then export LIBMPI="-lmpichf90 -lmpich -lmpl -lpthread" # MPICH2 1.3 or 1.4 else die "Unknown MPICH version" fi fi if [ "$ARCH" = "amd64" ]; then export NWCHEM_TARGET=LINUX64 elif [ "$ARCH" = "ia64" ]; then export NWCHEM_TARGET=LINUX64 elif [ "$ARCH" = "x86" ]; then export NWCHEM_TARGET=LINUX elif [ "$ARCH" = "ppc" ]; then export NWCHEM_TARGET=LINUX else die "Unknown architecture" fi if use python ; then if [ "$ARCH" = "amd64" ] || [ "$ARCH" = "ia64" ]; then export USE_PYTHON64=yes fi export PYTHONHOME=/usr export PYTHONVERSION=$(eselect python show|awk -Fpython '{ print $2 }') export PYTHONPATH=./:${S}/contrib/python/ export NWCHEM_MODULES="all python" else export NWCHEM_MODULES="all" fi export NWCHEM_EXECUTABLE=${S}/bin/LINUX64/nwchem export NWCHEM_TOP=${S} export FC=gfortran export CC=gcc cd "${S}/src" emake DIAG=PAR FC=${FC} CC=${CC}|| die "Compilation failed" if use doc ; then cd "${S}/doc" emake || die "Compilation of ducomentation failed" fi } src_install() { dobin ${S}/bin/${NWCHEM_TARGET}/nwchem || die "Failed to install binary" dodir /usr/share/NWchem/data || die "Failed to create data directory" insinto /usr/share/NWchem/data doins -r ${S}/src/basis/libraries/* || die "Failed to install basis library" doins -r ${S}/src/data/* || die "Failed to install data" doins -r ${S}/src/nwpw/libraryps/* || die "Failed to install data" insinto /etc doins ${S}/nwchemrc if use doc ; then dodir /usr/share/doc/NWchem/ || die "Failed to create doc directory" insinto /usr/share/doc/NWchem/ doins ${S}/doc/user/user.001.ps || die "Failed to install documentation" doins ${S}/doc/user/user.002.ps || die "Failed to install documentation" doins ${S}/doc/user/user.003.ps || die "Failed to install documentation" fi } pkg_postinst() { elog elog "The user will need to link \$HOME/.nwchemrc to /etc/nwchemrc" elog "or copy it in order to tell NWChem the right position of the" elog "basis library and other necessary data." elog }