| author | wenzelm |
| Wed, 23 Mar 2022 13:05:54 +0100 | |
| changeset 75312 | e641ac92b489 |
| parent 75205 | c33e75542ffe |
| child 75393 | 87ebf5a50283 |
| permissions | -rw-r--r-- |
| 64483 | 1 |
/* Title: Pure/Admin/build_polyml.scala |
2 |
Author: Makarius |
|
3 |
||
4 |
Build Poly/ML from sources. |
|
5 |
*/ |
|
6 |
||
7 |
package isabelle |
|
8 |
||
9 |
||
| 69704 | 10 |
import scala.util.matching.Regex |
11 |
||
12 |
||
| 64483 | 13 |
object Build_PolyML |
14 |
{
|
|
| 65880 | 15 |
/** platform-specific build **/ |
| 64496 | 16 |
|
| 64483 | 17 |
sealed case class Platform_Info( |
18 |
options: List[String] = Nil, |
|
| 64487 | 19 |
setup: String = "", |
|
72462
7c552a256ca5
misc tuning and clarification: prefer Executable.libraries_closure;
wenzelm
parents:
72455
diff
changeset
|
20 |
libs: Set[String] = Set.empty) |
| 64483 | 21 |
|
22 |
private val platform_info = Map( |
|
| 69704 | 23 |
"linux" -> |
|
67580
eb64467e8bcf
more robust access to shared libraries for poly executable: avoid global change of LD_LIBRARY_PATH (e.g. relevant for subprocesses);
wenzelm
parents:
66998
diff
changeset
|
24 |
Platform_Info( |
| 69704 | 25 |
options = List("LDFLAGS=-Wl,-rpath,_DUMMY_"),
|
|
72462
7c552a256ca5
misc tuning and clarification: prefer Executable.libraries_closure;
wenzelm
parents:
72455
diff
changeset
|
26 |
libs = Set("libgmp")),
|
| 69704 | 27 |
"darwin" -> |
| 64483 | 28 |
Platform_Info( |
|
73666
4d0df84a5b88
clarified options: implicitly support both x86_64 and arm64;
wenzelm
parents:
73340
diff
changeset
|
29 |
options = List("CFLAGS=-O3", "CXXFLAGS=-O3", "LDFLAGS=-segprot POLY rwx rwx"),
|
| 69704 | 30 |
setup = "PATH=/usr/bin:/bin:/usr/sbin:/sbin", |
|
72462
7c552a256ca5
misc tuning and clarification: prefer Executable.libraries_closure;
wenzelm
parents:
72455
diff
changeset
|
31 |
libs = Set("libpolyml", "libgmp")),
|
| 69704 | 32 |
"windows" -> |
| 64483 | 33 |
Platform_Info( |
34 |
options = |
|
| 67597 | 35 |
List("--host=x86_64-w64-mingw32", "CPPFLAGS=-I/mingw64/include", "--disable-windows-gui"),
|
| 72427 | 36 |
setup = MinGW.environment_export, |
| 72468 | 37 |
libs = Set("libgcc_s_seh", "libgmp", "libstdc++", "libwinpthread")))
|
| 64483 | 38 |
|
39 |
def build_polyml( |
|
| 64489 | 40 |
root: Path, |
| 64495 | 41 |
sha1_root: Option[Path] = None, |
|
71726
a5fda30edae2
clarified signature: more uniform treatment of stopped/interrupted state;
wenzelm
parents:
71686
diff
changeset
|
42 |
progress: Progress = new Progress, |
| 64493 | 43 |
arch_64: Boolean = false, |
|
64485
e996c0a5eca9
support other bash executable (notably for msys on Windows);
wenzelm
parents:
64484
diff
changeset
|
44 |
options: List[String] = Nil, |
| 73340 | 45 |
mingw: MinGW = MinGW.none): Unit = |
| 64483 | 46 |
{
|
| 64489 | 47 |
if (!((root + Path.explode("configure")).is_file && (root + Path.explode("PolyML")).is_dir))
|
48 |
error("Bad Poly/ML root directory: " + root)
|
|
| 64483 | 49 |
|
|
72352
f4bd6f123fdf
more systematic platform support, including arm64-linux;
wenzelm
parents:
72351
diff
changeset
|
50 |
val platform = Isabelle_Platform.self |
| 69704 | 51 |
|
| 73667 | 52 |
val polyml_platform = |
53 |
(if (arch_64) platform.arch_64 else platform.arch_64_32) + "-" + platform.os_name |
|
|
72352
f4bd6f123fdf
more systematic platform support, including arm64-linux;
wenzelm
parents:
72351
diff
changeset
|
54 |
val sha1_platform = platform.arch_64 + "-" + platform.os_name |
| 64493 | 55 |
|
| 64483 | 56 |
val info = |
|
72352
f4bd6f123fdf
more systematic platform support, including arm64-linux;
wenzelm
parents:
72351
diff
changeset
|
57 |
platform_info.getOrElse(platform.os_name, |
|
f4bd6f123fdf
more systematic platform support, including arm64-linux;
wenzelm
parents:
72351
diff
changeset
|
58 |
error("Bad OS platform: " + quote(platform.os_name)))
|
| 64483 | 59 |
|
| 72455 | 60 |
if (platform.is_linux) Isabelle_System.require_command("chrpath")
|
| 70977 | 61 |
|
| 64491 | 62 |
|
| 64495 | 63 |
/* bash */ |
64 |
||
| 64504 | 65 |
def bash( |
|
73672
70d3c7009a65
proper support for macOS/Rosetta: let "uname -m" report arm64 instead of x86_64;
wenzelm
parents:
73667
diff
changeset
|
66 |
cwd: Path, script: String, |
|
70d3c7009a65
proper support for macOS/Rosetta: let "uname -m" report arm64 instead of x86_64;
wenzelm
parents:
73667
diff
changeset
|
67 |
redirect: Boolean = false, |
|
70d3c7009a65
proper support for macOS/Rosetta: let "uname -m" report arm64 instead of x86_64;
wenzelm
parents:
73667
diff
changeset
|
68 |
echo: Boolean = false): Process_Result = |
| 64504 | 69 |
{
|
|
73672
70d3c7009a65
proper support for macOS/Rosetta: let "uname -m" report arm64 instead of x86_64;
wenzelm
parents:
73667
diff
changeset
|
70 |
val script1 = |
|
70d3c7009a65
proper support for macOS/Rosetta: let "uname -m" report arm64 instead of x86_64;
wenzelm
parents:
73667
diff
changeset
|
71 |
if (platform.is_arm && platform.is_macos) {
|
|
70d3c7009a65
proper support for macOS/Rosetta: let "uname -m" report arm64 instead of x86_64;
wenzelm
parents:
73667
diff
changeset
|
72 |
"arch -arch arm64 bash -c " + Bash.string(script) |
|
70d3c7009a65
proper support for macOS/Rosetta: let "uname -m" report arm64 instead of x86_64;
wenzelm
parents:
73667
diff
changeset
|
73 |
} |
|
70d3c7009a65
proper support for macOS/Rosetta: let "uname -m" report arm64 instead of x86_64;
wenzelm
parents:
73667
diff
changeset
|
74 |
else mingw.bash_script(script) |
|
70d3c7009a65
proper support for macOS/Rosetta: let "uname -m" report arm64 instead of x86_64;
wenzelm
parents:
73667
diff
changeset
|
75 |
progress.bash(script1, cwd = cwd.file, redirect = redirect, echo = echo) |
| 64504 | 76 |
} |
| 64495 | 77 |
|
78 |
||
| 64491 | 79 |
/* configure and make */ |
80 |
||
| 64483 | 81 |
val configure_options = |
|
67783
839de121665c
more robust build: prevent problems seen with Poly/ML eb94e2820013 on Mac OS X;
wenzelm
parents:
67609
diff
changeset
|
82 |
List("--disable-shared", "--enable-intinf-as-int", "--with-gmp") :::
|
| 69704 | 83 |
info.options ::: options ::: (if (arch_64) Nil else List("--enable-compact32bit"))
|
| 64483 | 84 |
|
| 64495 | 85 |
bash(root, |
| 64487 | 86 |
info.setup + "\n" + |
|
64485
e996c0a5eca9
support other bash executable (notably for msys on Windows);
wenzelm
parents:
64484
diff
changeset
|
87 |
""" |
|
e996c0a5eca9
support other bash executable (notably for msys on Windows);
wenzelm
parents:
64484
diff
changeset
|
88 |
[ -f Makefile ] && make distclean |
|
e996c0a5eca9
support other bash executable (notably for msys on Windows);
wenzelm
parents:
64484
diff
changeset
|
89 |
{
|
|
e996c0a5eca9
support other bash executable (notably for msys on Windows);
wenzelm
parents:
64484
diff
changeset
|
90 |
./configure --prefix="$PWD/target" """ + Bash.strings(configure_options) + """ |
|
e996c0a5eca9
support other bash executable (notably for msys on Windows);
wenzelm
parents:
64484
diff
changeset
|
91 |
rm -rf target |
| 74635 | 92 |
make && make install |
|
64485
e996c0a5eca9
support other bash executable (notably for msys on Windows);
wenzelm
parents:
64484
diff
changeset
|
93 |
} || { echo "Build failed" >&2; exit 2; }
|
| 64501 | 94 |
""", redirect = true, echo = true).check |
|
64485
e996c0a5eca9
support other bash executable (notably for msys on Windows);
wenzelm
parents:
64484
diff
changeset
|
95 |
|
| 64491 | 96 |
|
| 64495 | 97 |
/* sha1 library */ |
98 |
||
99 |
val sha1_files = |
|
100 |
if (sha1_root.isDefined) {
|
|
101 |
val dir1 = sha1_root.get |
|
|
72352
f4bd6f123fdf
more systematic platform support, including arm64-linux;
wenzelm
parents:
72351
diff
changeset
|
102 |
bash(dir1, "./build " + sha1_platform, redirect = true, echo = true).check |
| 64505 | 103 |
|
|
72352
f4bd6f123fdf
more systematic platform support, including arm64-linux;
wenzelm
parents:
72351
diff
changeset
|
104 |
val dir2 = dir1 + Path.explode(sha1_platform) |
|
72462
7c552a256ca5
misc tuning and clarification: prefer Executable.libraries_closure;
wenzelm
parents:
72455
diff
changeset
|
105 |
File.read_dir(dir2).map(entry => dir2 + Path.basic(entry)) |
| 64495 | 106 |
} |
107 |
else Nil |
|
108 |
||
109 |
||
|
72462
7c552a256ca5
misc tuning and clarification: prefer Executable.libraries_closure;
wenzelm
parents:
72455
diff
changeset
|
110 |
/* install */ |
| 64484 | 111 |
|
|
72462
7c552a256ca5
misc tuning and clarification: prefer Executable.libraries_closure;
wenzelm
parents:
72455
diff
changeset
|
112 |
val platform_dir = Path.explode(polyml_platform) |
|
7c552a256ca5
misc tuning and clarification: prefer Executable.libraries_closure;
wenzelm
parents:
72455
diff
changeset
|
113 |
Isabelle_System.rm_tree(platform_dir) |
|
7c552a256ca5
misc tuning and clarification: prefer Executable.libraries_closure;
wenzelm
parents:
72455
diff
changeset
|
114 |
Isabelle_System.make_directory(platform_dir) |
| 64483 | 115 |
|
| 73317 | 116 |
for (file <- sha1_files) Isabelle_System.copy_file(file, platform_dir) |
|
67592
66253039d5ca
enforce shared libpoly on all platforms, with File.copy before File.move;
wenzelm
parents:
67589
diff
changeset
|
117 |
|
| 64483 | 118 |
for {
|
| 64484 | 119 |
d <- List("target/bin", "target/lib")
|
| 64489 | 120 |
dir = root + Path.explode(d) |
| 64483 | 121 |
entry <- File.read_dir(dir) |
| 73317 | 122 |
} Isabelle_System.move_file(dir + Path.explode(entry), platform_dir) |
| 67584 | 123 |
|
| 72469 | 124 |
Executable.libraries_closure( |
125 |
platform_dir + Path.basic("poly").platform_exe, mingw = mingw, filter = info.libs)
|
|
126 |
||
| 67584 | 127 |
|
128 |
/* polyc: directory prefix */ |
|
129 |
||
| 72378 | 130 |
val Header = "#! */bin/sh".r |
| 75205 | 131 |
File.change_lines(platform_dir + Path.explode("polyc")) {
|
132 |
case Header() :: lines => |
|
133 |
val lines1 = |
|
134 |
lines.map(line => |
|
135 |
if (line.startsWith("prefix=")) "prefix=\"$(cd \"$(dirname \"$0\")\"; pwd)\""
|
|
136 |
else if (line.startsWith("BINDIR=")) "BINDIR=\"$prefix\""
|
|
137 |
else if (line.startsWith("LIBDIR=")) "LIBDIR=\"$prefix\""
|
|
138 |
else line) |
|
139 |
"#!/usr/bin/env bash" :: lines1 |
|
140 |
case lines => |
|
141 |
error(cat_lines("Cannot patch polyc -- undetected header:" :: lines.take(3)))
|
|
| 75202 | 142 |
} |
| 64483 | 143 |
} |
144 |
||
145 |
||
| 64496 | 146 |
|
| 65880 | 147 |
/** skeleton for component **/ |
148 |
||
| 73340 | 149 |
private def extract_sources(source_archive: Path, component_dir: Path): Unit = |
| 65880 | 150 |
{
|
|
71396
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
151 |
if (source_archive.get_ext == "zip") {
|
|
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
152 |
Isabelle_System.bash( |
|
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
153 |
"unzip -x " + File.bash_path(source_archive.absolute), cwd = component_dir.file).check |
|
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
154 |
} |
|
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
155 |
else {
|
|
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
156 |
Isabelle_System.gnutar("-xzf " + File.bash_path(source_archive), dir = component_dir).check
|
|
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
157 |
} |
|
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
158 |
|
|
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
159 |
val src_dir = component_dir + Path.explode("src")
|
|
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
160 |
File.read_dir(component_dir) match {
|
| 73317 | 161 |
case List(s) => Isabelle_System.move_file(component_dir + Path.basic(s), src_dir) |
|
71396
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
162 |
case _ => error("Source archive contains multiple directories")
|
|
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
163 |
} |
|
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
164 |
|
|
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
165 |
val lines = split_lines(File.read(src_dir + Path.explode("RootX86.ML")))
|
|
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
166 |
val ml_files = |
|
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
167 |
for {
|
|
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
168 |
line <- lines |
|
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
169 |
rest <- Library.try_unprefix("use", line)
|
|
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
170 |
} yield "ML_file" + rest |
| 65880 | 171 |
|
|
71396
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
172 |
File.write(src_dir + Path.explode("ROOT.ML"),
|
|
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
173 |
"""(* Poly/ML Compiler root file. |
|
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
174 |
|
|
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
175 |
When this file is open in the Prover IDE, the ML files of the Poly/ML |
|
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
176 |
compiler can be explored interactively. This is a separate copy: it does |
|
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
177 |
not affect the running ML session. *) |
|
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
178 |
""" + ml_files.mkString("\n", "\n", "\n"))
|
|
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
179 |
} |
|
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
180 |
|
|
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
181 |
def build_polyml_component( |
|
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
182 |
source_archive: Path, |
|
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
183 |
component_dir: Path, |
| 73340 | 184 |
sha1_root: Option[Path] = None): Unit = |
|
71396
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
185 |
{
|
| 72377 | 186 |
Isabelle_System.new_directory(component_dir) |
|
71396
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
187 |
extract_sources(source_archive, component_dir) |
|
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
188 |
|
| 73317 | 189 |
Isabelle_System.copy_file(Path.explode("~~/Admin/polyml/README"), component_dir)
|
|
71396
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
190 |
|
| 72376 | 191 |
val etc_dir = Isabelle_System.make_directory(component_dir + Path.explode("etc"))
|
| 73317 | 192 |
Isabelle_System.copy_file(Path.explode("~~/Admin/polyml/settings"), etc_dir)
|
| 64483 | 193 |
|
| 65880 | 194 |
sha1_root match {
|
195 |
case Some(dir) => |
|
|
71396
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
196 |
Mercurial.repository(dir).archive(File.standard_path(component_dir + Path.explode("sha1")))
|
| 65880 | 197 |
case None => |
198 |
} |
|
199 |
} |
|
200 |
||
201 |
||
202 |
||
203 |
/** Isabelle tool wrappers **/ |
|
204 |
||
205 |
val isabelle_tool1 = |
|
| 72763 | 206 |
Isabelle_Tool("build_polyml", "build Poly/ML from sources", Scala_Project.here, args =>
|
|
64500
159ea1055b39
back to regular Isabelle tool (reverting abc34a149690);
wenzelm
parents:
64499
diff
changeset
|
207 |
{
|
| 72429 | 208 |
var mingw = MinGW.none |
| 73667 | 209 |
var arch_64 = false |
|
71686
eb44cf7ae926
tuned -- Command_Line.tool is already part of Isabelle_Tool;
wenzelm
parents:
71632
diff
changeset
|
210 |
var sha1_root: Option[Path] = None |
| 64483 | 211 |
|
|
71686
eb44cf7ae926
tuned -- Command_Line.tool is already part of Isabelle_Tool;
wenzelm
parents:
71632
diff
changeset
|
212 |
val getopts = Getopts("""
|
| 64489 | 213 |
Usage: isabelle build_polyml [OPTIONS] ROOT [CONFIGURE_OPTIONS] |
| 64483 | 214 |
|
215 |
Options are: |
|
| 72429 | 216 |
-M DIR msys/mingw root specification for Windows |
|
72352
f4bd6f123fdf
more systematic platform support, including arm64-linux;
wenzelm
parents:
72351
diff
changeset
|
217 |
-m ARCH processor architecture (32 or 64, default: """ + |
|
f4bd6f123fdf
more systematic platform support, including arm64-linux;
wenzelm
parents:
72351
diff
changeset
|
218 |
(if (arch_64) "64" else "32") + """) |
| 69691 | 219 |
-s DIR sha1 sources, see https://isabelle.sketis.net/repos/sha1 |
| 64483 | 220 |
|
| 64499 | 221 |
Build Poly/ML in the ROOT directory of its sources, with additional |
| 67593 | 222 |
CONFIGURE_OPTIONS (e.g. --without-gmp). |
| 64483 | 223 |
""", |
| 72431 | 224 |
"M:" -> (arg => mingw = MinGW(Path.explode(arg))), |
|
71686
eb44cf7ae926
tuned -- Command_Line.tool is already part of Isabelle_Tool;
wenzelm
parents:
71632
diff
changeset
|
225 |
"m:" -> |
|
eb44cf7ae926
tuned -- Command_Line.tool is already part of Isabelle_Tool;
wenzelm
parents:
71632
diff
changeset
|
226 |
{
|
|
72352
f4bd6f123fdf
more systematic platform support, including arm64-linux;
wenzelm
parents:
72351
diff
changeset
|
227 |
case "32" => arch_64 = false |
|
f4bd6f123fdf
more systematic platform support, including arm64-linux;
wenzelm
parents:
72351
diff
changeset
|
228 |
case "64" => arch_64 = true |
|
71686
eb44cf7ae926
tuned -- Command_Line.tool is already part of Isabelle_Tool;
wenzelm
parents:
71632
diff
changeset
|
229 |
case bad => error("Bad processor architecture: " + quote(bad))
|
|
eb44cf7ae926
tuned -- Command_Line.tool is already part of Isabelle_Tool;
wenzelm
parents:
71632
diff
changeset
|
230 |
}, |
|
eb44cf7ae926
tuned -- Command_Line.tool is already part of Isabelle_Tool;
wenzelm
parents:
71632
diff
changeset
|
231 |
"s:" -> (arg => sha1_root = Some(Path.explode(arg)))) |
| 64483 | 232 |
|
|
71686
eb44cf7ae926
tuned -- Command_Line.tool is already part of Isabelle_Tool;
wenzelm
parents:
71632
diff
changeset
|
233 |
val more_args = getopts(args) |
|
eb44cf7ae926
tuned -- Command_Line.tool is already part of Isabelle_Tool;
wenzelm
parents:
71632
diff
changeset
|
234 |
val (root, options) = |
|
eb44cf7ae926
tuned -- Command_Line.tool is already part of Isabelle_Tool;
wenzelm
parents:
71632
diff
changeset
|
235 |
more_args match {
|
|
eb44cf7ae926
tuned -- Command_Line.tool is already part of Isabelle_Tool;
wenzelm
parents:
71632
diff
changeset
|
236 |
case root :: options => (Path.explode(root), options) |
|
eb44cf7ae926
tuned -- Command_Line.tool is already part of Isabelle_Tool;
wenzelm
parents:
71632
diff
changeset
|
237 |
case Nil => getopts.usage() |
|
eb44cf7ae926
tuned -- Command_Line.tool is already part of Isabelle_Tool;
wenzelm
parents:
71632
diff
changeset
|
238 |
} |
|
eb44cf7ae926
tuned -- Command_Line.tool is already part of Isabelle_Tool;
wenzelm
parents:
71632
diff
changeset
|
239 |
build_polyml(root, sha1_root = sha1_root, progress = new Console_Progress, |
| 72429 | 240 |
arch_64 = arch_64, options = options, mingw = mingw) |
|
69277
258bef08b31e
support for user-defined Isabelle/Scala command-line tools;
wenzelm
parents:
67783
diff
changeset
|
241 |
}) |
| 65880 | 242 |
|
243 |
val isabelle_tool2 = |
|
| 72763 | 244 |
Isabelle_Tool("build_polyml_component", "make skeleton for Poly/ML component",
|
245 |
Scala_Project.here, args => |
|
| 65880 | 246 |
{
|
|
71686
eb44cf7ae926
tuned -- Command_Line.tool is already part of Isabelle_Tool;
wenzelm
parents:
71632
diff
changeset
|
247 |
var sha1_root: Option[Path] = None |
| 65880 | 248 |
|
|
71686
eb44cf7ae926
tuned -- Command_Line.tool is already part of Isabelle_Tool;
wenzelm
parents:
71632
diff
changeset
|
249 |
val getopts = Getopts("""
|
|
71396
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
250 |
Usage: isabelle build_polyml_component [OPTIONS] SOURCE_ARCHIVE COMPONENT_DIR |
| 65880 | 251 |
|
252 |
Options are: |
|
| 69691 | 253 |
-s DIR sha1 sources, see https://isabelle.sketis.net/repos/sha1 |
| 65880 | 254 |
|
|
71396
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
255 |
Make skeleton for Poly/ML component, based on official source archive |
|
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
256 |
(zip or tar.gz). |
| 65880 | 257 |
""", |
|
71686
eb44cf7ae926
tuned -- Command_Line.tool is already part of Isabelle_Tool;
wenzelm
parents:
71632
diff
changeset
|
258 |
"s:" -> (arg => sha1_root = Some(Path.explode(arg)))) |
| 65880 | 259 |
|
|
71686
eb44cf7ae926
tuned -- Command_Line.tool is already part of Isabelle_Tool;
wenzelm
parents:
71632
diff
changeset
|
260 |
val more_args = getopts(args) |
|
71396
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
261 |
|
|
71686
eb44cf7ae926
tuned -- Command_Line.tool is already part of Isabelle_Tool;
wenzelm
parents:
71632
diff
changeset
|
262 |
val (source_archive, component_dir) = |
|
eb44cf7ae926
tuned -- Command_Line.tool is already part of Isabelle_Tool;
wenzelm
parents:
71632
diff
changeset
|
263 |
more_args match {
|
|
eb44cf7ae926
tuned -- Command_Line.tool is already part of Isabelle_Tool;
wenzelm
parents:
71632
diff
changeset
|
264 |
case List(archive, dir) => (Path.explode(archive), Path.explode(dir)) |
|
eb44cf7ae926
tuned -- Command_Line.tool is already part of Isabelle_Tool;
wenzelm
parents:
71632
diff
changeset
|
265 |
case _ => getopts.usage() |
|
eb44cf7ae926
tuned -- Command_Line.tool is already part of Isabelle_Tool;
wenzelm
parents:
71632
diff
changeset
|
266 |
} |
|
eb44cf7ae926
tuned -- Command_Line.tool is already part of Isabelle_Tool;
wenzelm
parents:
71632
diff
changeset
|
267 |
build_polyml_component(source_archive, component_dir, sha1_root = sha1_root) |
|
69277
258bef08b31e
support for user-defined Isabelle/Scala command-line tools;
wenzelm
parents:
67783
diff
changeset
|
268 |
}) |
| 64483 | 269 |
} |