homebrew-core/Formula/suite-sparse.rb

61 lines
1.9 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.10.1.tar.gz"
sha256 "acb4d1045f48a237e70294b950153e48dce5b5f9ca8190e86c2b8c54ce00a7ee"
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 cellar: :any, arm64_big_sur: "142ea7b857fc6325070033b3da8d4a80a578070a80ab61514f1dd00f866818d1"
sha256 cellar: :any, big_sur: "bd20cd872598931036422f7f8f64d0d9d5929b24ab353582375e35b425c90e72"
sha256 cellar: :any, catalina: "fb2af83a130798486be789c1e8d8f96c583c03c7753ec4e7fff8c4afa2f04eba"
sha256 cellar: :any, mojave: "3c4d62d70d63b82734c29224fc8cb779931a6cf6d88350dbbf47cc02f8a7b371"
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