homebrew-core/Formula/arpack.rb
2017-07-22 01:04:06 +02:00

61 lines
2 KiB
Ruby

class Arpack < Formula
desc "Routines to solve large scale eigenvalue problems"
homepage "https://github.com/opencollab/arpack-ng"
url "https://github.com/opencollab/arpack-ng/archive/3.5.0.tar.gz"
sha256 "50f7a3e3aec2e08e732a487919262238f8504c3ef927246ec3495617dde81239"
head "https://github.com/opencollab/arpack-ng.git"
bottle do
sha256 "96272ee3928cc30b8814aca520809b65fb94830d63ddaec928957ab0daaca330" => :sierra
sha256 "7311ad6d0936cd828e65fa7e27c189fa375c19538620c8252e06c813bb144435" => :el_capitan
sha256 "bd7aee67c923392a0038673e3f8c361a3bfec169b5ab03cb6cbb30f56c330d35" => :yosemite
end
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
depends_on :fortran
depends_on "veclibfort"
depends_on :mpi => [:optional, :f77]
def install
args = %W[ --disable-dependency-tracking
--prefix=#{libexec}
--with-blas=-L#{Formula["veclibfort"].opt_lib}\ -lvecLibFort ]
if build.with? "mpi"
args << "F77=#{ENV["MPIF77"]}" << "--enable-mpi"
end
system "./bootstrap"
system "./configure", *args
system "make"
system "make", "install"
lib.install_symlink Dir["#{libexec}/lib/*"].select { |f| File.file?(f) }
(lib/"pkgconfig").install_symlink Dir["#{libexec}/lib/pkgconfig/*"]
pkgshare.install "TESTS/testA.mtx", "TESTS/dnsimp.f",
"TESTS/mmio.f", "TESTS/debug.h"
if build.with? "mpi"
(libexec/"bin").install (buildpath/"PARPACK/EXAMPLES/MPI").children
end
end
test do
ENV.fortran
system ENV.fc, "-o", "test", pkgshare/"dnsimp.f", pkgshare/"mmio.f",
"-L#{lib}", "-larpack", "-lvecLibFort"
cp_r pkgshare/"testA.mtx", testpath
assert_match "reached", shell_output("./test")
if build.with? "mpi"
cp_r (libexec/"bin").children, testpath
%w[pcndrv1 pdndrv1 pdndrv3 pdsdrv1
psndrv1 psndrv3 pssdrv1 pzndrv1].each do |slv|
system "mpirun", "-np", "4", slv
end
end
end
end