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