author | wenzelm |
Mon, 13 Mar 2023 11:02:26 +0100 | |
changeset 77622 | f458547b4f0f |
parent 77566 | 2a99fcb283ee |
child 79629 | 4d81c0391da2 |
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_spass.scala |
72411
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
2 |
Author: Makarius |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
3 |
|
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
4 |
Build Isabelle SPASS component from unofficial download. |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
5 |
*/ |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
6 |
|
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
7 |
package isabelle |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
8 |
|
b8cc129ece05
build Isabelle SPASS component from unofficial download;
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_SPASS { |
72411
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
11 |
/* build SPASS */ |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
12 |
|
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
13 |
val default_download_url = "https://www.cs.vu.nl/~jbe248/spass-3.8ds-src.tar.gz" |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
14 |
val standard_version = "3.8ds" |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
15 |
|
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
16 |
def build_spass( |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
17 |
download_url: String = default_download_url, |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
18 |
progress: Progress = new Progress, |
77510
f5d6cd98b16a
clarified signature: manage "verbose" flag via "progress";
wenzelm
parents:
76548
diff
changeset
|
19 |
target_dir: Path = Path.current |
f5d6cd98b16a
clarified signature: manage "verbose" flag via "progress";
wenzelm
parents:
76548
diff
changeset
|
20 |
): Unit = { |
75394 | 21 |
Isabelle_System.with_tmp_dir("build") { tmp_dir => |
73650 | 22 |
Isabelle_System.require_command("bison") |
23 |
Isabelle_System.require_command("flex") |
|
72411
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
24 |
|
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
25 |
|
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
26 |
/* component */ |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
27 |
|
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
28 |
val Archive_Name = """^.*?([^/]+)$""".r |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
29 |
val Component_Name = """^(.+)-src\.tar.gz$""".r |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
30 |
val Version = """^[^-]+-([^-]+)$""".r |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
31 |
|
76540
83de6e9ae983
clarified signature: prefer Scala functions instead of shell scripts;
wenzelm
parents:
76518
diff
changeset
|
32 |
val archive_name = |
72411
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
33 |
download_url match { |
76540
83de6e9ae983
clarified signature: prefer Scala functions instead of shell scripts;
wenzelm
parents:
76518
diff
changeset
|
34 |
case Archive_Name(name) => name |
72411
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
35 |
case _ => error("Failed to determine source archive name from " + quote(download_url)) |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
36 |
} |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
37 |
|
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
38 |
val component_name = |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
39 |
archive_name match { |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
40 |
case Component_Name(name) => name |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
41 |
case _ => error("Failed to determine component name from " + quote(archive_name)) |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
42 |
} |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
43 |
|
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
44 |
val version = |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
45 |
component_name match { |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
46 |
case Version(version) => version |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
47 |
case _ => error("Failed to determine component version from " + quote(component_name)) |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
48 |
} |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
49 |
|
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
50 |
if (version != standard_version) { |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
51 |
progress.echo_warning("Odd SPASS version " + version + " (expected " + standard_version + ")") |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
52 |
} |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
53 |
|
76518 | 54 |
val component_dir = |
76547 | 55 |
Components.Directory(target_dir + Path.basic(component_name)).create(progress = progress) |
72411
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
56 |
|
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
57 |
val platform_name = |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
58 |
proper_string(Isabelle_System.getenv("ISABELLE_PLATFORM64")) |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
59 |
.getOrElse(error("No 64bit platform")) |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
60 |
|
76518 | 61 |
val platform_dir = |
62 |
Isabelle_System.make_directory(component_dir.path + Path.basic(platform_name)) |
|
72411
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
63 |
|
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
64 |
|
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
65 |
/* download source */ |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
66 |
|
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
67 |
val archive_path = tmp_dir + Path.basic(archive_name) |
73566 | 68 |
Isabelle_System.download_file(download_url, archive_path, progress = progress) |
72411
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
69 |
|
76540
83de6e9ae983
clarified signature: prefer Scala functions instead of shell scripts;
wenzelm
parents:
76518
diff
changeset
|
70 |
Isabelle_System.extract(archive_path, tmp_dir) |
83de6e9ae983
clarified signature: prefer Scala functions instead of shell scripts;
wenzelm
parents:
76518
diff
changeset
|
71 |
val source_dir = File.get_dir(tmp_dir, title = download_url) |
83de6e9ae983
clarified signature: prefer Scala functions instead of shell scripts;
wenzelm
parents:
76518
diff
changeset
|
72 |
|
76541 | 73 |
Isabelle_System.extract(archive_path, component_dir.src, strip = true) |
72411
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
74 |
|
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
75 |
|
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
76 |
/* build */ |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
77 |
|
72440 | 78 |
progress.echo("Building SPASS for " + platform_name + " ...") |
72411
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
79 |
|
72412 | 80 |
if (Platform.is_windows) { |
76540
83de6e9ae983
clarified signature: prefer Scala functions instead of shell scripts;
wenzelm
parents:
76518
diff
changeset
|
81 |
File.change(source_dir + Path.basic("misc.c")) { |
72412 | 82 |
_.replace("""#include "execinfo.h" """, "") |
75202 | 83 |
.replaceAll("""void misc_DumpCore\(void\)[^}]+}""", "void misc_DumpCore(void) { abort(); }") |
84 |
} |
|
72412 | 85 |
} |
86 |
||
76540
83de6e9ae983
clarified signature: prefer Scala functions instead of shell scripts;
wenzelm
parents:
76518
diff
changeset
|
87 |
Isabelle_System.bash("make", cwd = source_dir.file, |
77510
f5d6cd98b16a
clarified signature: manage "verbose" flag via "progress";
wenzelm
parents:
76548
diff
changeset
|
88 |
progress_stdout = progress.echo(_, verbose = true), |
f5d6cd98b16a
clarified signature: manage "verbose" flag via "progress";
wenzelm
parents:
76548
diff
changeset
|
89 |
progress_stderr = progress.echo(_, verbose = true)).check |
72411
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
90 |
|
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
91 |
|
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
92 |
/* install */ |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
93 |
|
76540
83de6e9ae983
clarified signature: prefer Scala functions instead of shell scripts;
wenzelm
parents:
76518
diff
changeset
|
94 |
Isabelle_System.copy_file(source_dir + Path.basic("LICENCE"), component_dir.LICENSE) |
72411
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
95 |
|
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
96 |
val install_files = List("SPASS") |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
97 |
for (name <- install_files ::: install_files.map(_ + ".exe")) { |
76540
83de6e9ae983
clarified signature: prefer Scala functions instead of shell scripts;
wenzelm
parents:
76518
diff
changeset
|
98 |
val path = source_dir + Path.basic(name) |
73317 | 99 |
if (path.is_file) Isabelle_System.copy_file(path, platform_dir) |
72411
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
100 |
} |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
101 |
|
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
102 |
|
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
103 |
/* settings */ |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
104 |
|
76548 | 105 |
component_dir.write_settings(""" |
72411
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
106 |
SPASS_HOME="$COMPONENT/$ISABELLE_PLATFORM64" |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
107 |
SPASS_VERSION=""" + quote(version) + """ |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
108 |
""") |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
109 |
|
76548 | 110 |
|
72411
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
111 |
/* README */ |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
112 |
|
76518 | 113 |
File.write(component_dir.README, |
72411
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
114 |
"""This distribution of SPASS 3.8ds, described in Blanchette, Popescu, Wand, and |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
115 |
Weidenbach's ITP 2012 paper "More SPASS with Isabelle", has been compiled from |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
116 |
sources available at """ + download_url + """ |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
117 |
via "make". |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
118 |
|
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
119 |
The Windows/Cygwin compilation required commenting out the line |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
120 |
|
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
121 |
#include "execinfo.h" |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
122 |
|
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
123 |
in "misc.c" as well as most of the body of the "misc_DumpCore" function. |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
124 |
|
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
125 |
The latest official SPASS sources can be downloaded from |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
126 |
http://www.spass-prover.org/. Be aware, however, that the official SPASS |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
127 |
releases are not compatible with Isabelle. |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
128 |
|
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
129 |
|
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
130 |
Viel SPASS! |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
131 |
|
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
132 |
|
72444 | 133 |
Jasmin Blanchette |
134 |
16-May-2018 |
|
72411
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
135 |
|
72444 | 136 |
Makarius |
137 |
""" + Date.Format.date(Date.now()) + "\n") |
|
75394 | 138 |
} |
72411
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
139 |
} |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
140 |
|
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
141 |
/* Isabelle tool wrapper */ |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
142 |
|
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
143 |
val isabelle_tool = |
77566
2a99fcb283ee
renamed administrative tools to build Isabelle components (unrelated to "isabelle build");
wenzelm
parents:
77510
diff
changeset
|
144 |
Isabelle_Tool("component_spass", "build prover component from source distribution", |
75394 | 145 |
Scala_Project.here, |
146 |
{ args => |
|
147 |
var target_dir = Path.current |
|
148 |
var download_url = default_download_url |
|
149 |
var verbose = false |
|
72411
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
150 |
|
75394 | 151 |
val getopts = Getopts(""" |
77566
2a99fcb283ee
renamed administrative tools to build Isabelle components (unrelated to "isabelle build");
wenzelm
parents:
77510
diff
changeset
|
152 |
Usage: isabelle component_spass [OPTIONS] |
72411
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
153 |
|
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
154 |
Options are: |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
155 |
-D DIR target directory (default ".") |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
156 |
-U URL download URL |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
157 |
(default: """" + default_download_url + """") |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
158 |
-v verbose |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
159 |
|
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
160 |
Build prover component from the specified source distribution. |
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
161 |
""", |
75394 | 162 |
"D:" -> (arg => target_dir = Path.explode(arg)), |
163 |
"U:" -> (arg => download_url = arg), |
|
164 |
"v" -> (_ => verbose = true)) |
|
72411
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
165 |
|
75394 | 166 |
val more_args = getopts(args) |
167 |
if (more_args.nonEmpty) getopts.usage() |
|
72411
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
168 |
|
77510
f5d6cd98b16a
clarified signature: manage "verbose" flag via "progress";
wenzelm
parents:
76548
diff
changeset
|
169 |
val progress = new Console_Progress(verbose = verbose) |
72411
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
170 |
|
77510
f5d6cd98b16a
clarified signature: manage "verbose" flag via "progress";
wenzelm
parents:
76548
diff
changeset
|
171 |
build_spass(download_url = download_url, progress = progress, target_dir = target_dir) |
75394 | 172 |
}) |
72411
b8cc129ece05
build Isabelle SPASS component from unofficial download;
wenzelm
parents:
diff
changeset
|
173 |
} |