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.8.0.tar.gz" sha256 "1c7e3ce7582e39d617666491e11794e3dc08ec3e3aedd38aaa79710f7845c919" head "https://github.com/ibex-team/ibex-lib.git" bottle do cellar :any sha256 "165faaaac6f07a735e29a395dddcdd2ac4029538443a5587a2027efe8dbd958e" => :mojave sha256 "c09babf3b0c6a8e4202caaacb3a4cdeed27ae703a0f8d48f988edb135eee6112" => :high_sierra sha256 "f3ff0ac76a65dd8b2fdfd04b15fc1f134555a103ecf294a1ab7d4402c2527678" => :sierra end depends_on "bison" => :build depends_on "flex" => :build depends_on "pkg-config" => [:build, :test] def install ENV.cxx11 # Reported 9 Oct 2017 https://github.com/ibex-team/ibex-lib/issues/286 ENV.deparallelize system "./waf", "configure", "--prefix=#{prefix}", "--enable-shared", "--lp-lib=soplex", "--with-optim" 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 ENV.cxx11 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