homebrew-core/Formula/arpack.rb
2018-05-03 09:31:27 +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"
revision 2
head "https://github.com/opencollab/arpack-ng.git"
bottle do
sha256 "ee8603f51963f07c30adc15b7d6c70dd0a137aa522433daf1fc7807f2eb77d99" => :high_sierra
sha256 "44d58367ee3ff51e50f16969fc463c331f87cdf2e77df9bc61ed54677fa9c9af" => :sierra
sha256 "155b3c0b91d364b5d48e1aae52229f8e624676f0a6840b6f3746100c99f26d67" => :el_capitan
end
option "with-mpi", "Enable parallel support"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
depends_on "gcc" # for gfortran
depends_on "veclibfort"
depends_on "open-mpi" if build.with? "mpi"
def install
args = %W[ --disable-dependency-tracking
--prefix=#{libexec}
--with-blas=-L#{Formula["veclibfort"].opt_lib}\ -lvecLibFort ]
args << "F77=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
system "gfortran", "-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