54 lines
2.0 KiB
Ruby
54 lines
2.0 KiB
Ruby
class Cbc < Formula
|
|
desc "Mixed integer linear programming solver"
|
|
homepage "https://github.com/coin-or/Cbc"
|
|
url "https://github.com/coin-or/Cbc/archive/releases/2.10.5.tar.gz"
|
|
sha256 "cc44c1950ff4615e7791d7e03ea34318ca001d3cac6dc3f7f5ee392459ce6719"
|
|
# update to EPL-2.0 on next release
|
|
license "EPL-1.0"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "56fee588e216483d5b63e6e6f61dc824325da64f61fcaa7af3c3f6692c0a004d" => :catalina
|
|
sha256 "d415cd6ac5c7afdda6e54d74e1acf76282ad81170333690bcd2ae3c08babdff5" => :mojave
|
|
sha256 "e1c7da5d2d650279cbc41a2dd6fe36d39f6298de743b59a27fbde6645f8f748b" => :high_sierra
|
|
end
|
|
|
|
depends_on "pkg-config" => :build
|
|
depends_on "cgl"
|
|
depends_on "clp"
|
|
depends_on "coinutils"
|
|
depends_on "osi"
|
|
|
|
def install
|
|
# Work around - same as clp formula
|
|
# Error 1: "mkdir: #{include}/cbc/coin: File exists."
|
|
mkdir include/"cbc/coin"
|
|
|
|
system "./configure", "--disable-debug",
|
|
"--disable-dependency-tracking",
|
|
"--disable-silent-rules",
|
|
"--prefix=#{prefix}",
|
|
"--includedir=#{include}/cbc"
|
|
system "make"
|
|
system "make", "install"
|
|
pkgshare.install "Cbc/examples"
|
|
end
|
|
|
|
test do
|
|
cp_r pkgshare/"examples/.", testpath
|
|
system ENV.cxx, "-std=c++11", "sudoku.cpp",
|
|
"-L#{lib}", "-lCbc",
|
|
"-L#{Formula["cgl"].opt_lib}", "-lCgl",
|
|
"-L#{Formula["clp"].opt_lib}", "-lClp", "-lOsiClp",
|
|
"-L#{Formula["coinutils"].opt_lib}", "-lCoinUtils",
|
|
"-L#{Formula["osi"].opt_lib}", "-lOsi",
|
|
"-I#{include}/cbc/coin",
|
|
"-I#{Formula["cgl"].opt_include}/cgl/coin",
|
|
"-I#{Formula["clp"].opt_include}/clp/coin",
|
|
"-I#{Formula["coinutils"].opt_include}/coinutils/coin",
|
|
"-I#{Formula["osi"].opt_include}/osi/coin",
|
|
"-o", "sudoku"
|
|
assert_match "solution is valid", shell_output("./sudoku")
|
|
end
|
|
end
|