author | wenzelm |
Mon, 01 Mar 2021 22:22:12 +0100 | |
changeset 73340 | 0ffcad1f6130 |
parent 73317 | df49ca5da9d0 |
child 73566 | 4e6b31ed7197 |
permissions | -rw-r--r-- |
72439 | 1 |
/* Title: Pure/Admin/build_csdp.scala |
2 |
Author: Makarius |
|
3 |
||
4 |
Build Isabelle veriT component from official download. |
|
5 |
*/ |
|
6 |
||
7 |
package isabelle |
|
8 |
||
9 |
||
10 |
object Build_VeriT |
|
11 |
{ |
|
72472
b54d4542d08c
update build script for veriT 2020.10-rmx
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72455
diff
changeset
|
12 |
val default_download_url = "https://verit.loria.fr/rmx/2020.10/verit-2020.10-rmx.tar.gz" |
72439 | 13 |
|
14 |
||
15 |
/* build veriT */ |
|
16 |
||
17 |
def build_verit( |
|
18 |
download_url: String = default_download_url, |
|
19 |
verbose: Boolean = false, |
|
20 |
progress: Progress = new Progress, |
|
72476 | 21 |
target_dir: Path = Path.current, |
73340 | 22 |
mingw: MinGW = MinGW.none): Unit = |
72439 | 23 |
{ |
72476 | 24 |
mingw.check |
25 |
||
72439 | 26 |
Isabelle_System.with_tmp_dir("build")(tmp_dir => |
27 |
{ |
|
28 |
/* component */ |
|
29 |
||
30 |
val Archive_Name = """^.*?([^/]+)$""".r |
|
31 |
val Version = """^[^-]+-(.+)\.tar.gz$""".r |
|
32 |
||
33 |
val archive_name = |
|
34 |
download_url match { |
|
35 |
case Archive_Name(name) => name |
|
36 |
case _ => error("Failed to determine source archive name from " + quote(download_url)) |
|
37 |
} |
|
38 |
||
39 |
val version = |
|
40 |
archive_name match { |
|
41 |
case Version(version) => version |
|
42 |
case _ => error("Failed to determine component version from " + quote(archive_name)) |
|
43 |
} |
|
44 |
||
45 |
val component_name = "verit-" + version |
|
46 |
val component_dir = Isabelle_System.new_directory(target_dir + Path.basic(component_name)) |
|
47 |
progress.echo("Component " + component_dir) |
|
48 |
||
49 |
||
50 |
/* platform */ |
|
51 |
||
52 |
val platform_name = |
|
72476 | 53 |
proper_string(Isabelle_System.getenv("ISABELLE_WINDOWS_PLATFORM64")) orElse |
72439 | 54 |
proper_string(Isabelle_System.getenv("ISABELLE_PLATFORM64")) getOrElse |
55 |
error("No 64bit platform") |
|
56 |
||
57 |
val platform_dir = Isabelle_System.make_directory(component_dir + Path.basic(platform_name)) |
|
58 |
||
59 |
||
60 |
/* download source */ |
|
61 |
||
62 |
val archive_path = tmp_dir + Path.basic(archive_name) |
|
63 |
Isabelle_System.download(download_url, archive_path, progress = progress) |
|
64 |
||
65 |
Isabelle_System.bash("tar xzf " + File.bash_path(archive_path), cwd = tmp_dir.file).check |
|
72442 | 66 |
val source_name = File.get_dir(tmp_dir) |
72439 | 67 |
|
68 |
Isabelle_System.bash( |
|
69 |
"tar xzf " + archive_path + " && mv " + Bash.string(source_name) + " src", |
|
70 |
cwd = component_dir.file).check |
|
71 |
||
72 |
||
73 |
/* build */ |
|
74 |
||
72440 | 75 |
progress.echo("Building veriT for " + platform_name + " ...") |
72439 | 76 |
|
72475 | 77 |
val configure_options = |
78 |
if (Platform.is_linux) "LDFLAGS=-Wl,-rpath,_DUMMY_" else "" |
|
79 |
||
72439 | 80 |
val build_dir = tmp_dir + Path.basic(source_name) |
72476 | 81 |
progress.bash(mingw.bash_script("set -e\n./configure " + configure_options + "\nmake"), |
72475 | 82 |
cwd = build_dir.file, echo = verbose).check |
72439 | 83 |
|
84 |
||
85 |
/* install */ |
|
86 |
||
73317 | 87 |
Isabelle_System.copy_file(build_dir + Path.explode("LICENSE"), component_dir) |
72475 | 88 |
|
89 |
val exe_path = Path.basic("veriT").platform_exe |
|
73317 | 90 |
Isabelle_System.copy_file(build_dir + exe_path, platform_dir) |
72476 | 91 |
Executable.libraries_closure(platform_dir + exe_path, filter = Set("libgmp"), mingw = mingw) |
72475 | 92 |
|
72439 | 93 |
|
94 |
/* settings */ |
|
95 |
||
96 |
val etc_dir = Isabelle_System.make_directory(component_dir + Path.basic("etc")) |
|
97 |
File.write(etc_dir + Path.basic("settings"), |
|
98 |
"""# -*- shell-script -*- :mode=shellscript: |
|
99 |
||
72478
b452242dce36
proper Isabelle component settings: prefer standard terminology "ISABELLE_VERIT", avoid conflict of "VERIT_VERSION" with processing of implicit options by veriT;
wenzelm
parents:
72476
diff
changeset
|
100 |
ISABELLE_VERIT="$COMPONENT/${ISABELLE_WINDOWS_PLATFORM64:-$ISABELLE_PLATFORM64}/veriT" |
72439 | 101 |
""") |
102 |
||
103 |
||
104 |
/* README */ |
|
105 |
||
106 |
File.write(component_dir + Path.basic("README"), |
|
107 |
"""This is veriT """ + version + """ from |
|
108 |
""" + download_url + """ |
|
109 |
||
110 |
It has been built from sources like this: |
|
72475 | 111 |
|
112 |
cd src |
|
113 |
./configure |
|
114 |
make |
|
115 |
||
72439 | 116 |
|
72443
ff5e700ed490
more robust: ignore existing gmp installation, but let veriT incorporate extern/gmp;
wenzelm
parents:
72442
diff
changeset
|
117 |
Makarius |
ff5e700ed490
more robust: ignore existing gmp installation, but let veriT incorporate extern/gmp;
wenzelm
parents:
72442
diff
changeset
|
118 |
""" + Date.Format.date(Date.now()) + "\n") |
72439 | 119 |
}) |
120 |
} |
|
121 |
||
122 |
||
123 |
/* Isabelle tool wrapper */ |
|
124 |
||
125 |
val isabelle_tool = |
|
126 |
Isabelle_Tool("build_verit", "build prover component from official download", |
|
72763 | 127 |
Scala_Project.here, args => |
72439 | 128 |
{ |
129 |
var target_dir = Path.current |
|
72476 | 130 |
var mingw = MinGW.none |
72439 | 131 |
var download_url = default_download_url |
132 |
var verbose = false |
|
133 |
||
134 |
val getopts = Getopts(""" |
|
135 |
Usage: isabelle build_verit [OPTIONS] |
|
136 |
||
137 |
Options are: |
|
138 |
-D DIR target directory (default ".") |
|
72476 | 139 |
-M DIR msys/mingw root specification for Windows |
72439 | 140 |
-U URL download URL |
141 |
(default: """" + default_download_url + """") |
|
142 |
-v verbose |
|
143 |
||
144 |
Build prover component from official download. |
|
145 |
""", |
|
146 |
"D:" -> (arg => target_dir = Path.explode(arg)), |
|
72476 | 147 |
"M:" -> (arg => mingw = MinGW(Path.explode(arg))), |
72439 | 148 |
"U:" -> (arg => download_url = arg), |
149 |
"v" -> (_ => verbose = true)) |
|
150 |
||
151 |
val more_args = getopts(args) |
|
152 |
if (more_args.nonEmpty) getopts.usage() |
|
153 |
||
154 |
val progress = new Console_Progress() |
|
155 |
||
156 |
build_verit(download_url = download_url, verbose = verbose, progress = progress, |
|
72476 | 157 |
target_dir = target_dir, mingw = mingw) |
72439 | 158 |
}) |
159 |
} |