author | wenzelm |
Sun, 20 Nov 2022 23:37:54 +0100 | |
changeset 76518 | b30b8e23383c |
parent 75394 | 42267c650205 |
child 76529 | ded37aade88e |
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 = |
45 |
Components.Directory.create(target_dir + Path.basic(component_name), 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 |
|
64 |
Isabelle_System.bash("tar xzf " + File.bash_path(archive_path), cwd = tmp_dir.file).check |
|
72442 | 65 |
val source_name = File.get_dir(tmp_dir) |
72439 | 66 |
|
67 |
Isabelle_System.bash( |
|
68 |
"tar xzf " + archive_path + " && mv " + Bash.string(source_name) + " src", |
|
76518 | 69 |
cwd = component_dir.path.file).check |
72439 | 70 |
|
71 |
||
72 |
/* build */ |
|
73 |
||
72440 | 74 |
progress.echo("Building veriT for " + platform_name + " ...") |
72439 | 75 |
|
72475 | 76 |
val configure_options = |
77 |
if (Platform.is_linux) "LDFLAGS=-Wl,-rpath,_DUMMY_" else "" |
|
78 |
||
72439 | 79 |
val build_dir = tmp_dir + Path.basic(source_name) |
72476 | 80 |
progress.bash(mingw.bash_script("set -e\n./configure " + configure_options + "\nmake"), |
72475 | 81 |
cwd = build_dir.file, echo = verbose).check |
72439 | 82 |
|
83 |
||
84 |
/* install */ |
|
85 |
||
76518 | 86 |
Isabelle_System.copy_file(build_dir + Path.explode("LICENSE"), component_dir.path) |
72475 | 87 |
|
88 |
val exe_path = Path.basic("veriT").platform_exe |
|
73317 | 89 |
Isabelle_System.copy_file(build_dir + exe_path, platform_dir) |
72476 | 90 |
Executable.libraries_closure(platform_dir + exe_path, filter = Set("libgmp"), mingw = mingw) |
72475 | 91 |
|
72439 | 92 |
|
93 |
/* settings */ |
|
94 |
||
76518 | 95 |
File.write(component_dir.settings, |
72439 | 96 |
"""# -*- shell-script -*- :mode=shellscript: |
97 |
||
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
|
98 |
ISABELLE_VERIT="$COMPONENT/${ISABELLE_WINDOWS_PLATFORM64:-$ISABELLE_PLATFORM64}/veriT" |
72439 | 99 |
""") |
100 |
||
101 |
||
102 |
/* README */ |
|
103 |
||
76518 | 104 |
File.write(component_dir.README, |
72439 | 105 |
"""This is veriT """ + version + """ from |
106 |
""" + download_url + """ |
|
107 |
||
108 |
It has been built from sources like this: |
|
72475 | 109 |
|
110 |
cd src |
|
111 |
./configure |
|
112 |
make |
|
113 |
||
72439 | 114 |
|
72443
ff5e700ed490
more robust: ignore existing gmp installation, but let veriT incorporate extern/gmp;
wenzelm
parents:
72442
diff
changeset
|
115 |
Makarius |
ff5e700ed490
more robust: ignore existing gmp installation, but let veriT incorporate extern/gmp;
wenzelm
parents:
72442
diff
changeset
|
116 |
""" + Date.Format.date(Date.now()) + "\n") |
75394 | 117 |
} |
72439 | 118 |
} |
119 |
||
120 |
||
121 |
/* Isabelle tool wrapper */ |
|
122 |
||
123 |
val isabelle_tool = |
|
124 |
Isabelle_Tool("build_verit", "build prover component from official download", |
|
75394 | 125 |
Scala_Project.here, |
126 |
{ args => |
|
127 |
var target_dir = Path.current |
|
128 |
var mingw = MinGW.none |
|
129 |
var download_url = default_download_url |
|
130 |
var verbose = false |
|
72439 | 131 |
|
75394 | 132 |
val getopts = Getopts(""" |
72439 | 133 |
Usage: isabelle build_verit [OPTIONS] |
134 |
||
135 |
Options are: |
|
136 |
-D DIR target directory (default ".") |
|
72476 | 137 |
-M DIR msys/mingw root specification for Windows |
72439 | 138 |
-U URL download URL |
139 |
(default: """" + default_download_url + """") |
|
140 |
-v verbose |
|
141 |
||
142 |
Build prover component from official download. |
|
143 |
""", |
|
75394 | 144 |
"D:" -> (arg => target_dir = Path.explode(arg)), |
145 |
"M:" -> (arg => mingw = MinGW(Path.explode(arg))), |
|
146 |
"U:" -> (arg => download_url = arg), |
|
147 |
"v" -> (_ => verbose = true)) |
|
72439 | 148 |
|
75394 | 149 |
val more_args = getopts(args) |
150 |
if (more_args.nonEmpty) getopts.usage() |
|
72439 | 151 |
|
75394 | 152 |
val progress = new Console_Progress() |
72439 | 153 |
|
75394 | 154 |
build_verit(download_url = download_url, verbose = verbose, progress = progress, |
155 |
target_dir = target_dir, mingw = mingw) |
|
156 |
}) |
|
72439 | 157 |
} |