homebrew-core/Formula/ibex.rb
2017-10-29 12:12:42 -07:00

74 lines
2.4 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.1.tar.gz"
sha256 "fa7ce3695f953a0158006dbeb8a391ebe1e84079abfec66a81c1ba993ac85396"
head "https://github.com/ibex-team/ibex-lib.git"
bottle do
cellar :any
sha256 "d3f12ab21b04b671404e2ec91f7e3121faf3165024cf8a2b1b9da93466589f47" => :high_sierra
sha256 "4fcba205722d9012a9175934e37fffa7f43cf32f330904cec6e9efea04f6d142" => :sierra
sha256 "ff7551ab159dfc698830fe08ed2cc995d9c315a482ad9e7e98f09b6bf03ce6c3" => :el_capitan
end
option "with-java", "Enable Java bindings for CHOCO solver."
option "with-ampl", "Use AMPL file loader plugin"
option "without-ensta-robotics", "Don't build the Contractors for robotics (SLAM) 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"
args << "--with-param-estim" if build.with? "param-estim"
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
system "make", "lab1", "lab2", "lab3", "lab4"
system "make", "-C", "slam", "slam1", "slam2", "slam3"
%w[lab1 lab2 lab3 lab4].each { |a| system "./#{a}" }
%w[slam1 slam2 slam3].each { |a| system "./slam/#{a}" }
end
end