-
Notifications
You must be signed in to change notification settings - Fork 1
/
touist.rb
66 lines (54 loc) · 2.61 KB
/
touist.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
class Touist < Formula
desc "The solver for the TouIST language"
homepage "https://www.irit.fr/touist"
url "https://github.com/touist/touist/archive/v3.5.2.tar.gz"
sha256 "faad60f20f88a9e539614dc9bdb30b42565cd7785cbbff200f18fd454f02b55f"
head "https://github.com/touist/touist.git", :shallow => false
# We use the git history for `git describe --tags`, so no shallow clone
bottle do
root_url "https://dl.bintray.com/touist/bottles-touist"
rebuild 1
sha256 cellar: high_sierra: "2056d25449dce23193cd156a818c3f5cdea5f904bd2f46b44839470f51557139"
sha256 cellar: sierra: "2056d25449dce23193cd156a818c3f5cdea5f904bd2f46b44839470f51557139"
sha256 cellar: el_capitan: "b20ccef6e14bd7ac4a89a28781ef8966cce3698562560a9c308da6138d91768d"
sha256 cellar: x86_64_linux: "ba6ee4a419629480e3b41957ea632b797eaf923c9f3070cda61cfa0c81f52471"
end
option "without-gmp", "Build without gmp which disables the yices2 support"
depends_on "opam" => :build
depends_on "ocaml" => :build
depends_on "gmp" => :build if OS.mac? && build.with?("gmp")
depends_on "gmp" if OS.linux? && build.with?("gmp")
def install
ENV["OPAMYES"] = "1"
opamroot = buildpath/"../opamroot"
opamroot.mkpath
ENV["OPAMROOT"] = opamroot
system "opam", "init", "--no-setup"
# Install the optionnal opam dependencies
# If CC is set to CC=clang during `opam install qbf`,
# then the ./configure of libs/quantor-3.2 won't not work
# because it (seemingly) expects CC to be 'cc*' or 'gcc*'.
ENV["CC"] = "" if ENV["CC"] == "clang"
system "opam", "install", "jbuilder", "qbf", *("yices2" if build.with? "gmp")
# jbuilder subst will turn %%VERSION%% into real version name; we need
# to do that BEFORE the pinning.
system "eval `opam config env`; jbuilder subst"
# Install the mandatory opam dependencies
system "opam", "pin", "add", ".", "--no-action"
# For some reason, `opam config exec -- jbuilder build` say that
# jbuilder is not found. Workaround: use eval `opam config env`
# instead.
system "eval `opam config env`; opam install touist --deps-only"
system "eval `opam config env`; jbuilder build"
bin.install "_build/default/src/main.exe" => "touist"
man1.install "_build/default/src/touist.1" => "touist.1"
end
test do
(testpath/"test.touist").write <<~EOS
(a and b => c) or d
EOS
system("#{bin}/touist", "#{testpath}/test.touist", "--solve")
system("#{bin}/touist", "#{testpath}/test.touist", "--solve", "--smt", "QF_LIA") if build.with? "gmp"
system("#{bin}/touist", "#{testpath}/test.touist", "--solve", "--qbf")
end
end