forked from ahmadia/homebrew-science
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsuperlu.rb
88 lines (75 loc) · 2.83 KB
/
superlu.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
class Superlu < Formula
desc "Solve large, sparse nonsymmetric systems of equations"
homepage "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
url "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/superlu_5.0.tar.gz"
sha256 "4856fa42b623e7047c1b0532ed0fc35f5dc283a74246a7f25ef8aa5155084ecc"
bottle do
cellar :any
sha256 "0ced0c80441e802e7d5db68b4c4e7822c9cfcdb6f5e621925fcd1662b71a545d" => :yosemite
sha256 "6943337b46db21f20a975b37cf068644fe8e2e29df5caae5d51d7cf7333854d1" => :mavericks
sha256 "3362dce78fcecccc3bfb99840a6f94b3b99b393e5b1cec88007897d2230875b3" => :mountain_lion
end
option "without-check", "skip build-time tests (not recommended)"
depends_on :fortran
depends_on "openblas" => :optional
def install
ENV.deparallelize
cp "MAKE_INC/make.mac-x", "./make.inc"
make_args = ["RANLIB=true", "CC=#{ENV.cc}", "CFLAGS=-fPIC #{ENV.cflags}",
"FORTRAN=#{ENV.fc}", "FFLAGS=#{ENV.fcflags}",
"SuperLUroot=#{buildpath}",
"SUPERLULIB=$(SuperLUroot)/lib/libsuperlu.a",
"NOOPTS=-fPIC"]
make_args << ((build.with? "openblas") ? "BLASLIB=-L#{Formula["openblas"].opt_lib} -lopenblas" : "BLASLIB=-framework Accelerate")
system "make", "lib", *make_args
if build.with? "check"
system "make", "testing", *make_args
cd "TESTING" do
system "make", *make_args
%w[stest dtest ctest ztest].each do |tst|
ohai `tail -1 #{tst}.out`.chomp
end
end
end
cd "EXAMPLE" do
system "make", *make_args
end
prefix.install "make.inc"
File.open(prefix / "make_args.txt", "w") do |f|
f.puts(make_args.join(" ")) # Record options passed to make.
end
lib.install Dir["lib/*"]
(include / "superlu").install Dir["SRC/*.h"]
doc.install Dir["Doc/*"]
(share / "superlu").install Dir["EXAMPLE/*[^.o]"]
end
test do
cd share / "superlu" do
system "./superlu"
system "./slinsol < g20.rua"
system "./slinsolx < g20.rua"
system "./slinsolx1 < g20.rua"
system "./slinsolx2 < g20.rua"
system "./dlinsol < g20.rua"
system "./dlinsolx < g20.rua"
system "./dlinsolx1 < g20.rua"
system "./dlinsolx2 < g20.rua"
system "./clinsol < cg20.cua"
system "./clinsolx < cg20.cua"
system "./clinsolx1 < cg20.cua"
system "./clinsolx2 < cg20.cua"
system "./zlinsol < cg20.cua"
system "./zlinsolx < cg20.cua"
system "./zlinsolx1 < cg20.cua"
system "./zlinsolx2 < cg20.cua"
system "./sitersol -h < g20.rua"
system "./sitersol1 -h < g20.rua"
system "./ditersol -h < g20.rua"
system "./ditersol1 -h < g20.rua"
system "./citersol -h < g20.rua"
system "./citersol1 -h < g20.rua"
system "./zitersol -h < cg20.cua"
system "./zitersol1 -h < cg20.cua"
end
end
end