equal
deleted
inserted
replaced
10 object Build_VeriT |
10 object Build_VeriT |
11 { |
11 { |
12 val default_download_url = "https://verit.loria.fr/distrib/veriT-stable2016.tar.gz" |
12 val default_download_url = "https://verit.loria.fr/distrib/veriT-stable2016.tar.gz" |
13 |
13 |
14 |
14 |
15 /* flags */ |
|
16 |
|
17 sealed case class Flags(platform: String, configure: String = "") |
|
18 { |
|
19 def print: Option[String] = |
|
20 if (configure.isEmpty) None |
|
21 else Some(" * " + platform + ":\n ./configure " + configure) |
|
22 } |
|
23 |
|
24 val build_flags: List[Flags] = |
|
25 List( |
|
26 Flags("arm64-linux", configure = "--enable-static"), |
|
27 Flags("x86_64-linux", configure = "--enable-static"), |
|
28 Flags("x86_64-darwin"), |
|
29 Flags("x86_64-cygwin")) |
|
30 |
|
31 |
|
32 /* build veriT */ |
15 /* build veriT */ |
33 |
16 |
34 def build_verit( |
17 def build_verit( |
35 download_url: String = default_download_url, |
18 download_url: String = default_download_url, |
36 verbose: Boolean = false, |
19 verbose: Boolean = false, |
39 { |
22 { |
40 Isabelle_System.with_tmp_dir("build")(tmp_dir => |
23 Isabelle_System.with_tmp_dir("build")(tmp_dir => |
41 { |
24 { |
42 /* required commands */ |
25 /* required commands */ |
43 |
26 |
44 List("autoconf", "bison", "flex").foreach(cmd => |
27 List("autoconf", "bison", "flex", "wget").foreach(cmd => |
45 if (!Isabelle_System.bash(cmd + " --version").ok) error("Missing command: " + cmd)) |
28 if (!Isabelle_System.bash(cmd + " --version").ok) error("Missing command: " + cmd)) |
46 |
29 |
47 |
30 |
48 /* component */ |
31 /* component */ |
49 |
32 |
92 /* build */ |
75 /* build */ |
93 |
76 |
94 progress.echo("Building veriT for " + platform_name + " ...") |
77 progress.echo("Building veriT for " + platform_name + " ...") |
95 |
78 |
96 val build_dir = tmp_dir + Path.basic(source_name) |
79 val build_dir = tmp_dir + Path.basic(source_name) |
97 |
|
98 val platform_build_flags = |
|
99 build_flags.find(flags => flags.platform == platform_name) match { |
|
100 case None => error("No build flags for platform " + quote(platform_name)) |
|
101 case Some(flags) => flags |
|
102 } |
|
103 |
|
104 val build_script = |
80 val build_script = |
105 """ |
81 """ |
106 set -e |
82 autoconf |
107 autoconf |
83 ./configure |
108 ./configure """ + platform_build_flags.configure + """ |
84 ln -s gmp-local extern/gmp |
109 make |
85 make |
110 """ |
86 """ |
111 progress.bash(build_script, cwd = build_dir.file, echo = verbose).check |
87 progress.bash("set -e\n" + build_script, cwd = build_dir.file, echo = verbose).check |
112 |
88 |
113 |
89 |
114 /* install */ |
90 /* install */ |
115 |
91 |
116 File.copy(build_dir + Path.explode("LICENSE"), component_dir) |
92 File.copy(build_dir + Path.explode("LICENSE"), component_dir) |
140 File.write(component_dir + Path.basic("README"), |
116 File.write(component_dir + Path.basic("README"), |
141 """This is veriT """ + version + """ from |
117 """This is veriT """ + version + """ from |
142 """ + download_url + """ |
118 """ + download_url + """ |
143 |
119 |
144 It has been built from sources like this: |
120 It has been built from sources like this: |
|
121 """ + build_script + """ |
145 |
122 |
146 autoconf && ./configure && make |
123 Makarius |
147 |
124 """ + Date.Format.date(Date.now()) + "\n") |
148 Some platforms require specific flags as follows: |
|
149 |
|
150 """ + build_flags.flatMap(_.print).mkString("\n\n") + """ |
|
151 |
|
152 |
|
153 Makarius |
|
154 """ + Date.Format.date(Date.now()) + "\n") |
|
155 }) |
125 }) |
156 } |
126 } |
157 |
127 |
158 |
128 |
159 /* Isabelle tool wrapper */ |
129 /* Isabelle tool wrapper */ |