class Coinutils < Formula desc "COIN-OR utilities" homepage "https://github.com/coin-or/CoinUtils" url "https://github.com/coin-or/CoinUtils/archive/releases/2.11.3.tar.gz" sha256 "7c4753816e765974941db75ec89f8855e56b86959f3a5f068fdf95b0003be61c" bottle do cellar :any sha256 "f04c7cacc5bc07a72a74006e365852d3320bbb12ff45dfee7a0c0cdd081f0783" => :mojave sha256 "5d10180ac9ea677a134c16f52dc4a4a51df0fb29c224e33784f106c67b2e0d85" => :high_sierra sha256 "7b13f124f38742ff92f9c487abaefe008f947ce00fd59582f8add1a15a4a32ae" => :sierra end depends_on "pkg-config" => :build depends_on "openblas" resource "coin-or-tools-data-sample-p0201-mps" do url "https://raw.githubusercontent.com/coin-or-tools/Data-Sample/releases/1.2.11/p0201.mps" sha256 "8352d7f121289185f443fdc67080fa9de01e5b9bf11b0bf41087fba4277c07a4" end def install args = [ "--datadir=#{pkgshare}", "--disable-debug", "--disable-dependency-tracking", "--includedir=#{include}/coinutils", "--prefix=#{prefix}", "--with-blas-incdir=#{Formula["openblas"].opt_include}", "--with-blas-lib=-L#{Formula["openblas"].opt_lib} -lopenblas", "--with-lapack-incdir=#{Formula["openblas"].opt_include}", "--with-lapack-lib=-L#{Formula["openblas"].opt_lib} -lopenblas", ] system "./configure", *args system "make" # Deparallelize due to error 1: "mkdir: #{include}/coinutils/coin: File exists." # https://github.com/coin-or/Clp/issues/109 ENV.deparallelize system "make", "install" end test do resource("coin-or-tools-data-sample-p0201-mps").stage testpath (testpath/"test.cpp").write <<~EOS #include int main() { CoinMpsIO mpsIO; return mpsIO.readMps("#{testpath}/p0201.mps"); } EOS system ENV.cxx, "test.cpp", "-I#{opt_include}/coinutils/coin", "-L#{opt_lib}", "-lCoinUtils" system "./a.out" end end