78 lines
2.2 KiB
Ruby
78 lines
2.2 KiB
Ruby
class Ibex < Formula
|
|
desc "C++ library for constraint processing over real numbers"
|
|
homepage "http://www.ibex-lib.org/"
|
|
url "https://github.com/ibex-team/ibex-lib/archive/ibex-2.6.3.tar.gz"
|
|
sha256 "55f6d1dddadd8818cef0d1251a5637cb21ccf353f22392360375f2deed213864"
|
|
head "https://github.com/ibex-team/ibex-lib.git"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "b64d56dc20a566e3276edca37326f005070dee046bb20be81302e4ecf2748d66" => :high_sierra
|
|
sha256 "c4777f842a2536da1d5fcd0962a4dc4cada8cb135c1892778c8f3415308b2e7d" => :sierra
|
|
sha256 "098308ad900c41c1fb8b8136a8cae0f9d85b3e78b36008ca2ae949cc40ca01e7" => :el_capitan
|
|
end
|
|
|
|
option "with-java", "Enable Java bindings for CHOCO solver."
|
|
option "with-ampl", "Use AMPL file loader plugin"
|
|
|
|
depends_on :java => ["1.8+", :optional]
|
|
depends_on "bison" => :build
|
|
depends_on "flex" => :build
|
|
depends_on "pkg-config" => :build
|
|
|
|
needs :cxx11
|
|
|
|
def install
|
|
ENV.cxx11
|
|
|
|
# Reported 9 Oct 2017 https://github.com/ibex-team/ibex-lib/issues/286
|
|
ENV.deparallelize
|
|
|
|
if build.with?("java") && build.with?("ampl")
|
|
odie "Cannot set options --with-java and --with-ampl simultaneously for now."
|
|
end
|
|
|
|
args = %W[
|
|
--prefix=#{prefix}
|
|
--enable-shared
|
|
--with-optim
|
|
--lp-lib=soplex
|
|
]
|
|
|
|
args << "--with-jni" if build.with? "java"
|
|
args << "--with-ampl" if build.with? "ampl"
|
|
|
|
system "./waf", "configure", *args
|
|
system "./waf", "install"
|
|
|
|
pkgshare.install %w[examples plugins/solver/benchs]
|
|
(pkgshare/"examples/symb01.txt").write <<~EOS
|
|
function f(x)
|
|
return ((2*x,-x);(-x,3*x));
|
|
end
|
|
EOS
|
|
end
|
|
|
|
test do
|
|
cp_r (pkgshare/"examples").children, testpath
|
|
|
|
# so that pkg-config can remain a build-time only dependency
|
|
inreplace %w[makefile slam/makefile] do |s|
|
|
s.gsub! /CXXFLAGS.*pkg-config --cflags ibex./,
|
|
"CXXFLAGS := -I#{include} -I#{include}/ibex "\
|
|
"-I#{include}/ibex/3rd"
|
|
s.gsub! /LIBS.*pkg-config --libs ibex./, "LIBS := -L#{lib} -libex"
|
|
end
|
|
|
|
(1..8).each do |n|
|
|
system "make", "lab#{n}"
|
|
system "./lab#{n}"
|
|
end
|
|
|
|
(1..3).each do |n|
|
|
system "make", "-C", "slam", "slam#{n}"
|
|
system "./slam/slam#{n}"
|
|
end
|
|
end
|
|
end
|