77 lines
2.2 KiB
Ruby
77 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.4.tar.gz"
|
|
sha256 "f59d4d7a77ca7d1a0f0926caed825a5e284a927de5202f584bce4cac3aeb1d90"
|
|
head "https://github.com/ibex-team/ibex-lib.git"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "94a734be24019ffb5567a0937bf48b1161c53bb0e553f71dac067fc5a24987ed" => :high_sierra
|
|
sha256 "f8a7013ceb439028655d4583790dbd6c68cea179301223d6f40b486d96a6ec63" => :sierra
|
|
sha256 "5cebbd21926601440436cb3a4b7aa860b1400af4e1d23a4903e2311271d50efb" => :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
|