| author | wenzelm |
| Mon, 19 Dec 2022 15:29:24 +0100 | |
| changeset 76714 | 95a926d483c5 |
| parent 76548 | 0af64cc2eee9 |
| child 77510 | f5d6cd98b16a |
| 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 |
||
| 75393 | 10 |
object Build_VeriT {
|
| 74819 | 11 |
val default_download_url = "https://verit.loria.fr/rmx/2021.06.2/verit-2021.06.2-rmx.tar.gz" |
| 72439 | 12 |
|
13 |
||
14 |
/* build veriT */ |
|
15 |
||
16 |
def build_verit( |
|
17 |
download_url: String = default_download_url, |
|
18 |
verbose: Boolean = false, |
|
19 |
progress: Progress = new Progress, |
|
| 72476 | 20 |
target_dir: Path = Path.current, |
| 75393 | 21 |
mingw: MinGW = MinGW.none |
22 |
): Unit = {
|
|
| 72476 | 23 |
mingw.check |
24 |
||
| 75394 | 25 |
Isabelle_System.with_tmp_dir("build") { tmp_dir =>
|
| 72439 | 26 |
/* component */ |
27 |
||
28 |
val Archive_Name = """^.*?([^/]+)$""".r |
|
29 |
val Version = """^[^-]+-(.+)\.tar.gz$""".r |
|
30 |
||
31 |
val archive_name = |
|
32 |
download_url match {
|
|
33 |
case Archive_Name(name) => name |
|
34 |
case _ => error("Failed to determine source archive name from " + quote(download_url))
|
|
35 |
} |
|
36 |
||
37 |
val version = |
|
38 |
archive_name match {
|
|
39 |
case Version(version) => version |
|
40 |
case _ => error("Failed to determine component version from " + quote(archive_name))
|
|
41 |
} |
|
42 |
||
43 |
val component_name = "verit-" + version |
|
| 76518 | 44 |
val component_dir = |
| 76547 | 45 |
Components.Directory(target_dir + Path.basic(component_name)).create(progress = progress) |
| 72439 | 46 |
|
47 |
||
48 |
/* platform */ |
|
49 |
||
50 |
val platform_name = |
|
| 72476 | 51 |
proper_string(Isabelle_System.getenv("ISABELLE_WINDOWS_PLATFORM64")) orElse
|
| 72439 | 52 |
proper_string(Isabelle_System.getenv("ISABELLE_PLATFORM64")) getOrElse
|
53 |
error("No 64bit platform")
|
|
54 |
||
| 76518 | 55 |
val platform_dir = |
56 |
Isabelle_System.make_directory(component_dir.path + Path.basic(platform_name)) |
|
| 72439 | 57 |
|
58 |
||
59 |
/* download source */ |
|
60 |
||
61 |
val archive_path = tmp_dir + Path.basic(archive_name) |
|
| 73566 | 62 |
Isabelle_System.download_file(download_url, archive_path, progress = progress) |
| 72439 | 63 |
|
|
76540
83de6e9ae983
clarified signature: prefer Scala functions instead of shell scripts;
wenzelm
parents:
76529
diff
changeset
|
64 |
Isabelle_System.extract(archive_path, tmp_dir) |
| 76529 | 65 |
val source_dir = File.get_dir(tmp_dir, title = download_url) |
| 72439 | 66 |
|
| 76541 | 67 |
Isabelle_System.extract(archive_path, component_dir.src, strip = true) |
| 72439 | 68 |
|
69 |
||
70 |
/* build */ |
|
71 |
||
| 72440 | 72 |
progress.echo("Building veriT for " + platform_name + " ...")
|
| 72439 | 73 |
|
| 72475 | 74 |
val configure_options = |
75 |
if (Platform.is_linux) "LDFLAGS=-Wl,-rpath,_DUMMY_" else "" |
|
76 |
||
| 72476 | 77 |
progress.bash(mingw.bash_script("set -e\n./configure " + configure_options + "\nmake"),
|
| 76529 | 78 |
cwd = source_dir.file, echo = verbose).check |
| 72439 | 79 |
|
80 |
||
81 |
/* install */ |
|
82 |
||
| 76529 | 83 |
Isabelle_System.copy_file(source_dir + Path.explode("LICENSE"), component_dir.path)
|
| 72475 | 84 |
|
85 |
val exe_path = Path.basic("veriT").platform_exe
|
|
| 76529 | 86 |
Isabelle_System.copy_file(source_dir + exe_path, platform_dir) |
| 72476 | 87 |
Executable.libraries_closure(platform_dir + exe_path, filter = Set("libgmp"), mingw = mingw)
|
| 72475 | 88 |
|
| 72439 | 89 |
|
90 |
/* settings */ |
|
91 |
||
| 76548 | 92 |
component_dir.write_settings("""
|
|
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
|
93 |
ISABELLE_VERIT="$COMPONENT/${ISABELLE_WINDOWS_PLATFORM64:-$ISABELLE_PLATFORM64}/veriT"
|
| 72439 | 94 |
""") |
95 |
||
96 |
||
97 |
/* README */ |
|
98 |
||
| 76518 | 99 |
File.write(component_dir.README, |
| 72439 | 100 |
"""This is veriT """ + version + """ from |
101 |
""" + download_url + """ |
|
102 |
||
103 |
It has been built from sources like this: |
|
| 72475 | 104 |
|
105 |
cd src |
|
106 |
./configure |
|
107 |
make |
|
108 |
||
| 72439 | 109 |
|
|
72443
ff5e700ed490
more robust: ignore existing gmp installation, but let veriT incorporate extern/gmp;
wenzelm
parents:
72442
diff
changeset
|
110 |
Makarius |
|
ff5e700ed490
more robust: ignore existing gmp installation, but let veriT incorporate extern/gmp;
wenzelm
parents:
72442
diff
changeset
|
111 |
""" + Date.Format.date(Date.now()) + "\n") |
| 75394 | 112 |
} |
| 72439 | 113 |
} |
114 |
||
115 |
||
116 |
/* Isabelle tool wrapper */ |
|
117 |
||
118 |
val isabelle_tool = |
|
119 |
Isabelle_Tool("build_verit", "build prover component from official download",
|
|
| 75394 | 120 |
Scala_Project.here, |
121 |
{ args =>
|
|
122 |
var target_dir = Path.current |
|
123 |
var mingw = MinGW.none |
|
124 |
var download_url = default_download_url |
|
125 |
var verbose = false |
|
| 72439 | 126 |
|
| 75394 | 127 |
val getopts = Getopts("""
|
| 72439 | 128 |
Usage: isabelle build_verit [OPTIONS] |
129 |
||
130 |
Options are: |
|
131 |
-D DIR target directory (default ".") |
|
| 72476 | 132 |
-M DIR msys/mingw root specification for Windows |
| 72439 | 133 |
-U URL download URL |
134 |
(default: """" + default_download_url + """") |
|
135 |
-v verbose |
|
136 |
||
137 |
Build prover component from official download. |
|
138 |
""", |
|
| 75394 | 139 |
"D:" -> (arg => target_dir = Path.explode(arg)), |
140 |
"M:" -> (arg => mingw = MinGW(Path.explode(arg))), |
|
141 |
"U:" -> (arg => download_url = arg), |
|
142 |
"v" -> (_ => verbose = true)) |
|
| 72439 | 143 |
|
| 75394 | 144 |
val more_args = getopts(args) |
145 |
if (more_args.nonEmpty) getopts.usage() |
|
| 72439 | 146 |
|
| 75394 | 147 |
val progress = new Console_Progress() |
| 72439 | 148 |
|
| 75394 | 149 |
build_verit(download_url = download_url, verbose = verbose, progress = progress, |
150 |
target_dir = target_dir, mingw = mingw) |
|
151 |
}) |
|
| 72439 | 152 |
} |