Skip to content

Commit

Permalink
mistral: add initial formula
Browse files Browse the repository at this point in the history
  • Loading branch information
Dekker1 committed Jun 18, 2022
1 parent ecccb08 commit e00b4a4
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions Formula/mistral.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
class Mistral < Formula
desc "Open source constraint programming library and FlatZinc solver written in C++"
homepage "https://github.com/ehebrard/Mistral-2.0"
url "https://github.com/ehebrard/Mistral-2.0/archive/83de8f7b8cc7f1fc41baa9befc89c91674775ea4.tar.gz"
version "2020-08-25"
sha256 "e52a4e5694a8cb17233b575c175c8d428b6589f77b8d191adacc8ecab947f782"
license "AGPL-3.0-only"
head "https://github.com/ehebrard/Mistral-2.0.git", branch: "master"

depends_on "boost" => :build
depends_on "python"

def install
system "make", "-C", "fz"

bin.install "fz/mistral-fzn"
inreplace "fz/mistral-fz" do |s|
s.gsub!("env python", "env python3")
s.gsub!("mcmd = ['mistral-fzn']", "mcmd = ['#{bin}/mistral-fzn']")
end
bin.install "fz/mistral-fz"

(share / "minizinc").mkpath
(share / "minizinc").install "fz/mznlib" => "mistral"

(share / "minizinc/solvers").mkpath
(share / "minizinc/solvers/mistral.msc").write <<~EOS
{
"id": "org.mistral.mistral",
"name": "Mistral",
"description": "Mistral FlatZinc interface",
"version": "#{version}",
"mznlib": "#{share}/minizinc/mistral",
"executable": "#{bin}/mistral-fz",
"tags": ["cp", "int"],
"stdFlags": ["-a"],
"extraFlags": [],
"supportsMzn": false,
"supportsFzn": true,
"needsSolns2Out": true,
"needsMznExecutable": false,
"needsStdlibDir": false,
"isGUIApplication": false
}
EOS
end

test do
(testpath/"test.fzn").write <<~EOS
var bool: x1;
solve satisfy;
EOS
assert_match "----------", shell_output("#{bin}/mistral-fz test.fzn").strip
end
end

0 comments on commit e00b4a4

Please sign in to comment.