homebrew-core/Formula/suite-sparse.rb

45 lines
1.5 KiB
Ruby

class SuiteSparse < Formula
desc "Suite of Sparse Matrix Software"
homepage "http://faculty.cse.tamu.edu/davis/suitesparse.html"
url "https://github.com/DrTimothyAldenDavis/SuiteSparse/archive/v5.6.0.tar.gz"
sha256 "76d34d9f6dafc592b69af14f58c1dc59e24853dcd7c2e8f4c98ffa223f6a1adb"
bottle do
cellar :any
sha256 "8eb58bbbd72d6ccc7a4aba9b2809a6dbd644fa885ff4928c1e407d468312b1a3" => :catalina
sha256 "d120874fd9475e4b65f2314da7db2cad5b20e2ece303c58a6cbd6dd36f8e47cf" => :mojave
sha256 "d578edbc2eb5813a86a85b7e2af8083bfcf3dc6aa265263b9c1c87feeb2cbd4a" => :high_sierra
end
depends_on "cmake" => :build
depends_on "metis"
depends_on "openblas"
conflicts_with "mongoose", :because => "suite-sparse vendors libmongoose.dylib"
def install
mkdir "GraphBLAS/build" do
system "cmake", "..", *std_cmake_args
end
args = [
"INSTALL=#{prefix}",
"BLAS=-L#{Formula["openblas"].opt_lib} -lopenblas",
"LAPACK=$(BLAS)",
"MY_METIS_LIB=-L#{Formula["metis"].opt_lib} -lmetis",
"MY_METIS_INC=#{Formula["metis"].opt_include}",
]
system "make", "library", *args
system "make", "install", *args
lib.install Dir["**/*.a"]
pkgshare.install "KLU/Demo/klu_simple.c"
end
test do
system ENV.cc, "-o", "test", pkgshare/"klu_simple.c",
"-L#{lib}", "-lsuitesparseconfig", "-lklu"
assert_predicate testpath/"test", :exist?
assert_match "x [0] = 1", shell_output("./test")
end
end