homebrew-core/Formula/suite-sparse.rb

61 lines
1.8 KiB
Ruby

class SuiteSparse < Formula
desc "Suite of Sparse Matrix Software"
homepage "https://people.engr.tamu.edu/davis/suitesparse.html"
url "https://github.com/DrTimothyAldenDavis/SuiteSparse/archive/v5.9.0.tar.gz"
sha256 "7bdd4811f1cf0767c5fdb5e435817fdadee50b0acdb598f4882ae7b8291a7f24"
license all_of: [
"BSD-3-Clause",
"LGPL-2.1-or-later",
"GPL-2.0-or-later",
"Apache-2.0",
"GPL-3.0-only",
any_of: ["LGPL-3.0-or-later", "GPL-2.0-or-later"],
]
livecheck do
url :stable
regex(/^v?(\d+(?:\.\d+)+)$/i)
end
bottle do
sha256 arm64_big_sur: "ad13471adbc81500b37605fad72f94cc4a41312b55f6af3794e1d2d91b162bd7"
sha256 big_sur: "f1f5e535b5abffaa3a6c9eae800a21068fb5c865e5fd5012ba760287cfa8c7f5"
sha256 catalina: "d52f50fbd23d137afed31f0da7145df08a4256ba486597c021e4d55990f497a4"
sha256 mojave: "975ce6b0517e9f03a97acb96d83617ee44c94d503b598003a3a1c937f97cac33"
end
depends_on "cmake" => :build
depends_on "metis"
depends_on "openblas"
depends_on "tbb"
uses_from_macos "m4"
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