author | wenzelm |
Fri, 16 Feb 2024 11:25:11 +0100 | |
changeset 79629 | 4d81c0391da2 |
parent 77566 | 2a99fcb283ee |
child 79752 | 788f11af9822 |
permissions | -rw-r--r-- |
77566
2a99fcb283ee
renamed administrative tools to build Isabelle components (unrelated to "isabelle build");
wenzelm
parents:
77510
diff
changeset
|
1 |
/* Title: Pure/Admin/component_e.scala |
72363
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
2 |
Author: Makarius |
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
3 |
|
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
4 |
Build Isabelle E prover component from official downloads. |
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
5 |
*/ |
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
6 |
|
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
7 |
package isabelle |
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
8 |
|
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
9 |
|
77566
2a99fcb283ee
renamed administrative tools to build Isabelle components (unrelated to "isabelle build");
wenzelm
parents:
77510
diff
changeset
|
10 |
object Component_E { |
72363
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
11 |
/* build E prover */ |
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
12 |
|
74359 | 13 |
val default_version = "2.6" |
72408 | 14 |
val default_download_url = "https://wwwlehre.dhbw-stuttgart.de/~sschulz/WORK/E_DOWNLOAD" |
72363
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
15 |
|
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
16 |
def build_e( |
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
17 |
version: String = default_version, |
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
18 |
download_url: String = default_download_url, |
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
19 |
progress: Progress = new Progress, |
75393 | 20 |
target_dir: Path = Path.current |
21 |
): Unit = { |
|
75394 | 22 |
Isabelle_System.with_tmp_dir("build") { tmp_dir => |
72363
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
23 |
/* component */ |
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
24 |
|
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
25 |
val component_name = "e-" + version |
76518 | 26 |
val component_dir = |
76547 | 27 |
Components.Directory(target_dir + Path.basic(component_name)).create(progress = progress) |
72363
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
28 |
|
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
29 |
val platform_name = |
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
30 |
proper_string(Isabelle_System.getenv("ISABELLE_PLATFORM64")) |
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
31 |
.getOrElse(error("No 64bit platform")) |
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
32 |
|
76518 | 33 |
val platform_dir = |
34 |
Isabelle_System.make_directory(component_dir.path + Path.basic(platform_name)) |
|
72363
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
35 |
|
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
36 |
|
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
37 |
/* download source */ |
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
38 |
|
72410 | 39 |
val archive_url = download_url + "/V_" + version + "/E.tgz" |
40 |
val archive_path = tmp_dir + Path.explode("E.tgz") |
|
73566 | 41 |
Isabelle_System.download_file(archive_url, archive_path, progress = progress) |
72363
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
42 |
|
76540
83de6e9ae983
clarified signature: prefer Scala functions instead of shell scripts;
wenzelm
parents:
76518
diff
changeset
|
43 |
Isabelle_System.extract(archive_path, tmp_dir) |
83de6e9ae983
clarified signature: prefer Scala functions instead of shell scripts;
wenzelm
parents:
76518
diff
changeset
|
44 |
val source_dir = File.get_dir(tmp_dir, title = archive_url) |
83de6e9ae983
clarified signature: prefer Scala functions instead of shell scripts;
wenzelm
parents:
76518
diff
changeset
|
45 |
|
76541 | 46 |
Isabelle_System.extract(archive_path, component_dir.src, strip = true) |
72363
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
47 |
|
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
48 |
|
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
49 |
/* build */ |
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
50 |
|
72440 | 51 |
progress.echo("Building E prover for " + platform_name + " ...") |
72363
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
52 |
|
75393 | 53 |
val build_options = { |
76540
83de6e9ae983
clarified signature: prefer Scala functions instead of shell scripts;
wenzelm
parents:
76518
diff
changeset
|
54 |
val result = Isabelle_System.bash("./configure --help", cwd = source_dir.file) |
72363
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
55 |
if (result.check.out.containsSlice("--enable-ho")) " --enable-ho" else "" |
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
56 |
} |
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
57 |
|
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
58 |
val build_script = "./configure" + build_options + " && make" |
76540
83de6e9ae983
clarified signature: prefer Scala functions instead of shell scripts;
wenzelm
parents:
76518
diff
changeset
|
59 |
Isabelle_System.bash(build_script, cwd = source_dir.file, |
77510
f5d6cd98b16a
clarified signature: manage "verbose" flag via "progress";
wenzelm
parents:
76548
diff
changeset
|
60 |
progress_stdout = progress.echo(_, verbose = true), |
f5d6cd98b16a
clarified signature: manage "verbose" flag via "progress";
wenzelm
parents:
76548
diff
changeset
|
61 |
progress_stderr = progress.echo(_, verbose = true)).check |
72363
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
62 |
|
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
63 |
|
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
64 |
/* install */ |
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
65 |
|
76540
83de6e9ae983
clarified signature: prefer Scala functions instead of shell scripts;
wenzelm
parents:
76518
diff
changeset
|
66 |
Isabelle_System.copy_file(source_dir + Path.basic("COPYING"), component_dir.LICENSE) |
72363
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
67 |
|
72406
a49be9fc83c3
discontinued unused eproof_ram (actually absent in version 2.5);
wenzelm
parents:
72405
diff
changeset
|
68 |
val install_files = List("epclextract", "eprover", "eprover-ho") |
72364 | 69 |
for (name <- install_files ::: install_files.map(_ + ".exe")) { |
76540
83de6e9ae983
clarified signature: prefer Scala functions instead of shell scripts;
wenzelm
parents:
76518
diff
changeset
|
70 |
val path = source_dir + Path.basic("PROVER") + Path.basic(name) |
73317 | 71 |
if (path.is_file) Isabelle_System.copy_file(path, platform_dir) |
72363
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
72 |
} |
72364 | 73 |
Isabelle_System.bash("if [ -f eprover-ho ]; then mv eprover-ho eprover; fi", |
72363
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
74 |
cwd = platform_dir.file).check |
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
75 |
|
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
76 |
|
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
77 |
/* settings */ |
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
78 |
|
76548 | 79 |
component_dir.write_settings(""" |
72363
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
80 |
E_HOME="$COMPONENT/$ISABELLE_PLATFORM64" |
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
81 |
E_VERSION=""" + quote(version) + """ |
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
82 |
""") |
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
83 |
|
76548 | 84 |
|
72363
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
85 |
/* README */ |
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
86 |
|
76518 | 87 |
File.write(component_dir.README, |
72410 | 88 |
"This is E prover " + version + " from\n" + archive_url + """ |
72363
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
89 |
|
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
90 |
The distribution has been built like this: |
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
91 |
|
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
92 |
cd src && """ + build_script + """ |
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
93 |
|
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
94 |
Only a few executables from PROVERS/ have been moved to the platform-specific |
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
95 |
Isabelle component directory: x86_64-linux etc. |
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
96 |
|
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
97 |
|
72444 | 98 |
Makarius |
99 |
""" + Date.Format.date(Date.now()) + "\n") |
|
75394 | 100 |
} |
72363
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
101 |
} |
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
102 |
|
79629 | 103 |
|
72363
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
104 |
/* Isabelle tool wrapper */ |
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
105 |
|
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
106 |
val isabelle_tool = |
77566
2a99fcb283ee
renamed administrative tools to build Isabelle components (unrelated to "isabelle build");
wenzelm
parents:
77510
diff
changeset
|
107 |
Isabelle_Tool("component_e", "build prover component from source distribution", Scala_Project.here, |
75394 | 108 |
{ args => |
109 |
var target_dir = Path.current |
|
110 |
var version = default_version |
|
111 |
var download_url = default_download_url |
|
112 |
var verbose = false |
|
72363
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
113 |
|
75394 | 114 |
val getopts = Getopts(""" |
77566
2a99fcb283ee
renamed administrative tools to build Isabelle components (unrelated to "isabelle build");
wenzelm
parents:
77510
diff
changeset
|
115 |
Usage: isabelle component_e [OPTIONS] |
72363
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
116 |
|
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
117 |
Options are: |
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
118 |
-D DIR target directory (default ".") |
72416 | 119 |
-U URL download URL |
72396
63e83aaec7a8
Fix formatting of default value in help message of "build_e" component.
desharna
parents:
72395
diff
changeset
|
120 |
(default: """" + default_download_url + """") |
72416 | 121 |
-V VERSION version (default: """ + default_version + """) |
72363
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
122 |
-v verbose |
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
123 |
|
72408 | 124 |
Build prover component from the specified source distribution. |
72363
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
125 |
""", |
75394 | 126 |
"D:" -> (arg => target_dir = Path.explode(arg)), |
127 |
"U:" -> (arg => download_url = arg), |
|
128 |
"V:" -> (arg => version = arg), |
|
129 |
"v" -> (_ => verbose = true)) |
|
72363
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
130 |
|
75394 | 131 |
val more_args = getopts(args) |
132 |
if (more_args.nonEmpty) getopts.usage() |
|
72363
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
133 |
|
77510
f5d6cd98b16a
clarified signature: manage "verbose" flag via "progress";
wenzelm
parents:
76548
diff
changeset
|
134 |
val progress = new Console_Progress(verbose = verbose) |
72363
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
135 |
|
75394 | 136 |
build_e(version = version, download_url = download_url, |
77510
f5d6cd98b16a
clarified signature: manage "verbose" flag via "progress";
wenzelm
parents:
76548
diff
changeset
|
137 |
progress = progress, target_dir = target_dir) |
75394 | 138 |
}) |
72363
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
139 |
} |