# Copyright 1999-2003 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit fortran versionator DESCRIPTION="Model-Independent Parameter Estimation" HOMEPAGE="http://www.sspa.com/pest" SRC_URI="http://www.sspa.com/pest/download/unixpest.zip \ http://www.simulistics.com/documents/pestman.pdf" # PEST uses '_' between versions MY_PV=$(replace_all_version_separators '_') # License is poorly specified on the SSPA web site. It only says that # Pest is freeware. LICENSE="public-domain" SLOT="0" KEYWORDS="~amd64" IUSE="doc" DEPEND="app-arch/unzip" # Need a Fortran 90 compiler. FORTRAN="gfortran ifc" src_unpack() { cd "${WORKDIR}" mkdir pest cd pest unzip "${DISTDIR}"/unixpest.zip tar xvf "pest${MY_PV}.tar" # I decided it was cleaner to make all edits with sed, rather than a patch. sed -i 's:^INSTALLDIR=.*$:INSTALLDIR=${DESTDIR}\/usr\/bin:g' makefile for file in makefile pest.mak ppest.mak pestutl1.mak pestutl2.mak pestutl3.mak pestutl4.mak pestutl5.mak sensan.mak mpest.mak do sed -i 's:^F90=.*:F90=${FC}:g' "${file}" sed -i 's:^LD=.*:LD=${FC}:g' "${file}" if [ ${file} != 'makefile' ]; then sed -i 's:^FFLAGS=.*$:FFLAGS=-c:g' "${file}" fi done } src_compile() { FC="${FORTRANC}" export FC cd "${WORKDIR}/pest" make cppp || die "cppp make failed" for mfile in pest.mak ppest.mak pestutl1.mak pestutl2.mak pestutl3.mak pestutl4.mak pestutl5.mak sensan.mak mpest.mak do make -f ${mfile} all || die "${mfile} make failed" done } src_install() { cd "${WORKDIR}"/pest # Took this snippet from 'dobin' if [[ ! -d "${D}${DESTTREE}/bin" ]]; then install -d "${D}${DESTTREE}/bin" || exit 3 fi emake install DESTDIR="${D}" || die "emake install failed" if use doc ; then # Took the following from 'dodoc' in order to not compress # the pdf file. 'dodoc' always compresses. dir="${D}usr/share/doc/${PF}/${DOCDESTTREE}" if [ ! -d "${dir}" ] ; then install -d "${dir}" fi install -m0644 "${DISTDIR}"/pestman.pdf "${dir}" fi }