homebrew-core/Formula/arpack.rb
2017-09-16 05:25:11 -07:00

60 lines
2.1 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 "cdd1abaa2e059467e6cd5131e5d8d5a1bf10f4fb6424b5650e8daca88922d8d4" => :high_sierra
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 ]
args << "F77=#{ENV["MPIF77"]}" << "--enable-mpi" if build.with? "mpi"
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