2010-06-28 16:48:24 +00:00
|
|
|
require 'formula'
|
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class SuiteSparse < Formula
|
2011-12-17 00:19:33 +00:00
|
|
|
homepage 'http://www.cise.ufl.edu/research/sparse/SuiteSparse'
|
2012-08-22 22:11:30 +00:00
|
|
|
url 'http://www.cise.ufl.edu/research/sparse/SuiteSparse/SuiteSparse-4.0.2.tar.gz'
|
|
|
|
sha1 '46b24a28eef4b040ea5a02d2c43e82e28b7d6195'
|
|
|
|
|
2012-12-06 23:47:45 +00:00
|
|
|
option "without-tbb", "Do not link with tbb (Threading Building Block)"
|
2012-08-22 22:11:30 +00:00
|
|
|
option "with-metis", "Compile in metis libraries"
|
2012-12-06 23:47:45 +00:00
|
|
|
option "with-openblas", "Use openblas instead of Apple's Accelerate.framework"
|
2010-06-28 16:48:24 +00:00
|
|
|
|
2012-12-06 23:47:45 +00:00
|
|
|
depends_on "tbb" unless build.include? "without-tbb"
|
|
|
|
# Metis is optional for now because of
|
|
|
|
# cholmod_metis.c:164:21: error: use of undeclared identifier 'idxtype'
|
|
|
|
depends_on "metis" if build.include? "with-metis"
|
|
|
|
depends_on "homebrew/science/openblas" if build.include? "with-openblas"
|
2010-06-28 16:48:24 +00:00
|
|
|
|
|
|
|
def install
|
|
|
|
# SuiteSparse doesn't like to build in parallel
|
2012-04-08 16:12:34 +00:00
|
|
|
ENV.j1
|
2010-06-28 16:48:24 +00:00
|
|
|
|
2012-08-22 22:11:30 +00:00
|
|
|
inreplace 'SuiteSparse_config/SuiteSparse_config.mk' do |s|
|
2012-12-06 23:47:45 +00:00
|
|
|
if build.include? 'with-openblas'
|
|
|
|
s.change_make_var! "BLAS", "-lopenblas"
|
|
|
|
s.change_make_var! "LAPACK", "$(BLAS)"
|
|
|
|
else
|
|
|
|
s.change_make_var! "BLAS", "-Wl,-framework -Wl,Accelerate"
|
|
|
|
s.change_make_var! "LAPACK", "$(BLAS)"
|
|
|
|
end
|
|
|
|
|
|
|
|
unless build.include? "without-tbb"
|
|
|
|
s.change_make_var! "SPQR_CONFIG", "-DHAVE_TBB"
|
|
|
|
s.change_make_var! "TBB", "-ltbb"
|
|
|
|
end
|
2011-01-04 21:34:51 +00:00
|
|
|
|
2012-08-22 22:11:30 +00:00
|
|
|
if build.include? 'with-metis'
|
|
|
|
s.remove_make_var! "METIS_PATH"
|
|
|
|
s.change_make_var! "METIS", Formula.factory("metis").lib + "libmetis.a"
|
|
|
|
end
|
|
|
|
|
2011-01-04 21:34:51 +00:00
|
|
|
s.change_make_var! "INSTALL_LIB", lib
|
|
|
|
s.change_make_var! "INSTALL_INCLUDE", include
|
|
|
|
end
|
|
|
|
|
|
|
|
system "make library"
|
2010-06-28 16:48:24 +00:00
|
|
|
|
2011-01-04 21:34:51 +00:00
|
|
|
lib.mkpath
|
|
|
|
include.mkpath
|
|
|
|
system "make install"
|
2010-06-28 16:48:24 +00:00
|
|
|
end
|
|
|
|
end
|