forked from ahmadia/homebrew-science
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathslepc.rb
71 lines (57 loc) · 2.82 KB
/
slepc.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
class Slepc < Formula
desc "Scalable Library for Eigenvalue Computations"
homepage "http://www.grycap.upv.es/slepc"
url "http://slepc.upv.es/download/download.php?filename=slepc-3.6.1.tar.gz"
sha256 "c0a3997347144b145ec6f783feadc5021428f05a965c3f285b2dafa9f84eb8a6"
bottle do
sha256 "707c11d73e213a83c5033159eb767b819eee9056f965a99c0d87fca0a549bf8f" => :yosemite
sha256 "2f37b384325938f06e8f24ff7b3b0f2b6010890963d91a2767ba6a6fedad2875" => :mavericks
sha256 "9b46fea66ae5e0eac564f8496381044ef5a2dde56f90d0be39ad379ca6cff3c1" => :mountain_lion
end
deprecated_option "complex" => "with-complex"
option "with-complex", "Use complex version by default. Otherwise, real-valued version will be symlinked"
option "without-check", "Skip run-time tests (not recommended)"
option "with-openblas", "Install dependencies with openblas"
openblasdep = (build.with? "openblas") ? ["with-openblas"] : []
depends_on "petsc" => [:build] + openblasdep
depends_on :mpi => [:cc, :f90]
depends_on :fortran
depends_on :x11 => :optional
depends_on "arpack" => [:recommended, "with-mpi"] + openblasdep
def install
ENV.deparallelize
# these must be consistent with petsc.rb
petsc_arch_real = "real"
petsc_arch_complex = "complex"
ENV["SLEPC_DIR"] = Dir.getwd
args = ["--with-clean=true"]
args << "--with-arpack-dir=#{Formula["arpack"].lib}" << "--with-arpack-flags=-lparpack,-larpack" if build.with? "arpack"
# real
ENV["PETSC_DIR"] = "#{Formula["petsc"].opt_prefix}/#{petsc_arch_real}"
system "./configure", "--prefix=#{prefix}/#{petsc_arch_real}", *args
system "make"
system "make", "test" if build.with? "check"
system "make", "install"
# complex
ENV["PETSC_DIR"] = "#{Formula["petsc"].opt_prefix}/#{petsc_arch_complex}"
system "./configure", "--prefix=#{prefix}/#{petsc_arch_complex}", *args
system "make"
# TODO: investigate why complex tests fail to run on Linuxbrew
system "make", "test" if build.with? "check"
system "make", "install"
ohai "Test results are in ~/Library/Logs/Homebrew/slepc. Please check."
# Link what we need.
petsc_arch = ((build.include? "complex") ? petsc_arch_complex : petsc_arch_real)
include.install_symlink Dir["#{prefix}/#{petsc_arch}/include/*.h"],
"#{prefix}/#{petsc_arch}/finclude", "#{prefix}/#{petsc_arch}/slepc-private"
lib.install_symlink Dir["#{prefix}/#{petsc_arch}/lib/*.*"]
prefix.install_symlink "#{prefix}/#{petsc_arch}/conf"
doc.install "docs/slepc.pdf", Dir["docs/*.htm"], "docs/manualpages" # They're not really man pages.
pkgshare.install "share/slepc/datafiles"
end
def caveats; <<-EOS.undent
Set your SLEPC_DIR to #{prefix}/real or #{prefix}/complex.
Fortran modules are in #{prefix}/real/include and #{prefix}/complex/include.
EOS
end
end