Skip to content

Commit

Permalink
SuperLU: new formula.
Browse files Browse the repository at this point in the history
Thanks to @ysakamoto86
Closes #721.
  • Loading branch information
dpo committed May 5, 2014
1 parent 26da0ab commit 80dc760
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions superlu.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
require "formula"

class Superlu < Formula
homepage "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
url "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/superlu_4.3.tar.gz"
sha1 "d2863610d8c545d250ffd020b8e74dc667d7cbdd"

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=#{ENV.cflags}",
"FORTRAN=#{ENV.fc}", "FFLAGS=#{ENV.fcflags}"]

make_args << ((build.with? "openblas") ? "BLASLIB=-L#{Formula["openblas"].lib} -lopenblas" : "BLASLIB=-framework Accelerate")

system "make", "lib", *make_args
if build.with? "check"
system "make", "testing", "SuperLUroot=#{buildpath}", *make_args
cd "TESTING"
system "make", *make_args
%w[stest dtest ctest ztest].each do |tst|
ohai `tail -1 #{tst}.out`.chomp
end
cd ".."
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 "EXAMPLE"
end
end

0 comments on commit 80dc760

Please sign in to comment.