PortSystem 1.0

name          arpack
version       1
categories    math
platforms     darwin
maintainers		moll@isi.edu
description		Package for solving large scale eigenvalue problems
long_description  \
	ARPACK is a collection of Fortran77 subroutines designed to solve large \
	scale eigenvalue problems. \
homepage		  http://www.caam.rice.edu/software/ARPACK/
master_sites	http://www.caam.rice.edu/software/ARPACK/SRC/
distfiles     arpack96.tar.gz patch.tar.gz
checksums     arpack96.tar.gz md5 fffaa970198b285676f4156cebc8626e \
							patch.tar.gz md5 14830d758f195f272b8594a493501fa2
# We need gfortran. Gcc41 doesn't seem to compile on Intel Mac, so we'll take
# gcc42. Too bad that the actual gfortran binary in gcc42 is called 
# gfortran-dp-4.2, otherwise we could just say bin:gfortran:gcc42.
depends_build port:gcc42
use_configure	no
worksrcdir	 ARPACK
patchfiles		 arpack.patch
build.args all FC=gfortran-dp-4.2 home=${worksrcpath}
destroot    { 
   xinstall -m 644 -v -W ${worksrcpath} libarpack.a ${destroot}${prefix}/lib
}
post-destroot {
	system "ranlib ${destroot}${prefix}/lib/libarpack.a"
}

variant mpi {
  distfiles-append parpack96.tar.gz ppatch.tar.gz
  checksums-append parpack96.tar.gz md5 598d0453b938ccd99a078246be5927f3 \
									 ppatch.tar.gz md5 e6f0d70dd99f719c0efee351d0875c96
	pre-build { system "rm ${worksrcpath}/PARPACK/*/MPI/mpif.h" }
	depends_build bin:mpif77:openmpi
	build.args all FC=${prefix}/lib/openmpi/bin/mpif77 home=${worksrcpath}
	destroot    { 
	   xinstall -m 644 -v -W ${worksrcpath} libarpack.a libparpack.a ${destroot}${prefix}/lib
	}
	post-destroot {
		system "ranlib ${destroot}${prefix}/lib/libarpack.a"
		system "ranlib ${destroot}${prefix}/lib/libparpack.a"
	}
}