author | wenzelm |
Thu, 28 Mar 2024 11:35:39 +0100 | |
changeset 80049 | b525f783b784 |
parent 79754 | 9686af7b947a |
child 80153 | 8e3730b527e9 |
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 |
|
79752
788f11af9822
provide e-3.0.03 on all platforms, including arm64-linux and arm64-darwin --- still inactive;
wenzelm
parents:
79629
diff
changeset
|
13 |
val default_version = "3.0.03" |
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 |
|
80049 | 29 |
val platform_name = Isabelle_Platform.self.ISABELLE_PLATFORM(apple = true) |
76518 | 30 |
val platform_dir = |
31 |
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
|
32 |
|
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
33 |
|
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
34 |
/* download source */ |
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
35 |
|
72410 | 36 |
val archive_url = download_url + "/V_" + version + "/E.tgz" |
37 |
val archive_path = tmp_dir + Path.explode("E.tgz") |
|
73566 | 38 |
Isabelle_System.download_file(archive_url, archive_path, progress = progress) |
72363
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
39 |
|
76540
83de6e9ae983
clarified signature: prefer Scala functions instead of shell scripts;
wenzelm
parents:
76518
diff
changeset
|
40 |
Isabelle_System.extract(archive_path, tmp_dir) |
83de6e9ae983
clarified signature: prefer Scala functions instead of shell scripts;
wenzelm
parents:
76518
diff
changeset
|
41 |
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
|
42 |
|
76541 | 43 |
Isabelle_System.extract(archive_path, component_dir.src, strip = true) |
72363
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
44 |
|
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
45 |
|
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
46 |
/* build */ |
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
47 |
|
72440 | 48 |
progress.echo("Building E prover for " + platform_name + " ...") |
72363
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
49 |
|
75393 | 50 |
val build_options = { |
76540
83de6e9ae983
clarified signature: prefer Scala functions instead of shell scripts;
wenzelm
parents:
76518
diff
changeset
|
51 |
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
|
52 |
if (result.check.out.containsSlice("--enable-ho")) " --enable-ho" else "" |
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
53 |
} |
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
54 |
|
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
55 |
val build_script = "./configure" + build_options + " && make" |
76540
83de6e9ae983
clarified signature: prefer Scala functions instead of shell scripts;
wenzelm
parents:
76518
diff
changeset
|
56 |
Isabelle_System.bash(build_script, cwd = source_dir.file, |
77510
f5d6cd98b16a
clarified signature: manage "verbose" flag via "progress";
wenzelm
parents:
76548
diff
changeset
|
57 |
progress_stdout = progress.echo(_, verbose = true), |
f5d6cd98b16a
clarified signature: manage "verbose" flag via "progress";
wenzelm
parents:
76548
diff
changeset
|
58 |
progress_stderr = progress.echo(_, verbose = true)).check |
72363
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
59 |
|
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
60 |
|
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
61 |
/* install */ |
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
62 |
|
76540
83de6e9ae983
clarified signature: prefer Scala functions instead of shell scripts;
wenzelm
parents:
76518
diff
changeset
|
63 |
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
|
64 |
|
72406
a49be9fc83c3
discontinued unused eproof_ram (actually absent in version 2.5);
wenzelm
parents:
72405
diff
changeset
|
65 |
val install_files = List("epclextract", "eprover", "eprover-ho") |
72364 | 66 |
for (name <- install_files ::: install_files.map(_ + ".exe")) { |
76540
83de6e9ae983
clarified signature: prefer Scala functions instead of shell scripts;
wenzelm
parents:
76518
diff
changeset
|
67 |
val path = source_dir + Path.basic("PROVER") + Path.basic(name) |
73317 | 68 |
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
|
69 |
} |
72364 | 70 |
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
|
71 |
cwd = platform_dir.file).check |
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
72 |
|
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
73 |
|
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
74 |
/* settings */ |
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
75 |
|
76548 | 76 |
component_dir.write_settings(""" |
79752
788f11af9822
provide e-3.0.03 on all platforms, including arm64-linux and arm64-darwin --- still inactive;
wenzelm
parents:
79629
diff
changeset
|
77 |
E_HOME="$COMPONENT/${ISABELLE_APPLE_PLATFORM64:-$ISABELLE_PLATFORM64}" |
72363
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
78 |
E_VERSION=""" + quote(version) + """ |
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
79 |
""") |
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
80 |
|
76548 | 81 |
|
72363
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
82 |
/* README */ |
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
83 |
|
76518 | 84 |
File.write(component_dir.README, |
72410 | 85 |
"This is E prover " + version + " from\n" + archive_url + """ |
72363
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
86 |
|
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
87 |
The distribution has been built like this: |
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
88 |
|
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
89 |
cd src && """ + build_script + """ |
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
90 |
|
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
91 |
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
|
92 |
Isabelle component directory: x86_64-linux etc. |
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 |
|
72444 | 95 |
Makarius |
96 |
""" + Date.Format.date(Date.now()) + "\n") |
|
75394 | 97 |
} |
72363
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
98 |
} |
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
99 |
|
79629 | 100 |
|
72363
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
101 |
/* Isabelle tool wrapper */ |
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
102 |
|
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
103 |
val isabelle_tool = |
77566
2a99fcb283ee
renamed administrative tools to build Isabelle components (unrelated to "isabelle build");
wenzelm
parents:
77510
diff
changeset
|
104 |
Isabelle_Tool("component_e", "build prover component from source distribution", Scala_Project.here, |
75394 | 105 |
{ args => |
106 |
var target_dir = Path.current |
|
107 |
var version = default_version |
|
108 |
var download_url = default_download_url |
|
109 |
var verbose = false |
|
72363
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
110 |
|
75394 | 111 |
val getopts = Getopts(""" |
77566
2a99fcb283ee
renamed administrative tools to build Isabelle components (unrelated to "isabelle build");
wenzelm
parents:
77510
diff
changeset
|
112 |
Usage: isabelle component_e [OPTIONS] |
72363
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
113 |
|
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
114 |
Options are: |
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
115 |
-D DIR target directory (default ".") |
72416 | 116 |
-U URL download URL |
72396
63e83aaec7a8
Fix formatting of default value in help message of "build_e" component.
desharna
parents:
72395
diff
changeset
|
117 |
(default: """" + default_download_url + """") |
72416 | 118 |
-V VERSION version (default: """ + default_version + """) |
72363
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
119 |
-v verbose |
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
120 |
|
72408 | 121 |
Build prover component from the specified source distribution. |
72363
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
122 |
""", |
75394 | 123 |
"D:" -> (arg => target_dir = Path.explode(arg)), |
124 |
"U:" -> (arg => download_url = arg), |
|
125 |
"V:" -> (arg => version = arg), |
|
126 |
"v" -> (_ => verbose = true)) |
|
72363
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
127 |
|
75394 | 128 |
val more_args = getopts(args) |
129 |
if (more_args.nonEmpty) getopts.usage() |
|
72363
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
130 |
|
77510
f5d6cd98b16a
clarified signature: manage "verbose" flag via "progress";
wenzelm
parents:
76548
diff
changeset
|
131 |
val progress = new Console_Progress(verbose = verbose) |
72363
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
132 |
|
75394 | 133 |
build_e(version = version, download_url = download_url, |
77510
f5d6cd98b16a
clarified signature: manage "verbose" flag via "progress";
wenzelm
parents:
76548
diff
changeset
|
134 |
progress = progress, target_dir = target_dir) |
75394 | 135 |
}) |
72363
fc5f10691147
build Isabelle E prover component from official downloads;
wenzelm
parents:
diff
changeset
|
136 |
} |