author | wenzelm |
Wed, 09 Apr 2025 15:31:27 +0200 | |
changeset 82463 | 3125fd1ee69c |
parent 82142 | 508a673c87ac |
child 82464 | 7c9fcf2d6706 |
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_polyml.scala |
64483 | 2 |
Author: Makarius |
3 |
||
4 |
Build Poly/ML from sources. |
|
78772 | 5 |
|
6 |
Note: macOS 14 Sonoma requires "LDFLAGS=... -ld64". |
|
64483 | 7 |
*/ |
8 |
||
9 |
package isabelle |
|
10 |
||
11 |
||
77566
2a99fcb283ee
renamed administrative tools to build Isabelle components (unrelated to "isabelle build");
wenzelm
parents:
77510
diff
changeset
|
12 |
object Component_PolyML { |
65880 | 13 |
/** platform-specific build **/ |
64496 | 14 |
|
64483 | 15 |
sealed case class Platform_Info( |
16 |
options: List[String] = Nil, |
|
64487 | 17 |
setup: String = "", |
72462
7c552a256ca5
misc tuning and clarification: prefer Executable.libraries_closure;
wenzelm
parents:
72455
diff
changeset
|
18 |
libs: Set[String] = Set.empty) |
64483 | 19 |
|
20 |
private val platform_info = Map( |
|
69704 | 21 |
"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
|
22 |
Platform_Info( |
69704 | 23 |
options = List("LDFLAGS=-Wl,-rpath,_DUMMY_"), |
72462
7c552a256ca5
misc tuning and clarification: prefer Executable.libraries_closure;
wenzelm
parents:
72455
diff
changeset
|
24 |
libs = Set("libgmp")), |
69704 | 25 |
"darwin" -> |
64483 | 26 |
Platform_Info( |
73666
4d0df84a5b88
clarified options: implicitly support both x86_64 and arm64;
wenzelm
parents:
73340
diff
changeset
|
27 |
options = List("CFLAGS=-O3", "CXXFLAGS=-O3", "LDFLAGS=-segprot POLY rwx rwx"), |
69704 | 28 |
setup = "PATH=/usr/bin:/bin:/usr/sbin:/sbin", |
72462
7c552a256ca5
misc tuning and clarification: prefer Executable.libraries_closure;
wenzelm
parents:
72455
diff
changeset
|
29 |
libs = Set("libpolyml", "libgmp")), |
69704 | 30 |
"windows" -> |
64483 | 31 |
Platform_Info( |
32 |
options = |
|
67597 | 33 |
List("--host=x86_64-w64-mingw32", "CPPFLAGS=-I/mingw64/include", "--disable-windows-gui"), |
72427 | 34 |
setup = MinGW.environment_export, |
72468 | 35 |
libs = Set("libgcc_s_seh", "libgmp", "libstdc++", "libwinpthread"))) |
64483 | 36 |
|
82463
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
37 |
def bash( |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
38 |
cwd: Path, |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
39 |
platform: Isabelle_Platform, |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
40 |
mingw: MinGW, |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
41 |
script: String, |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
42 |
redirect: Boolean = false, |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
43 |
progress: Progress = new Progress |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
44 |
): Process_Result = { |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
45 |
val script1 = |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
46 |
if (platform.is_arm && platform.is_macos) { |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
47 |
"arch -arch arm64 bash -c " + Bash.string(script) |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
48 |
} |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
49 |
else mingw.bash_script(script) |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
50 |
progress.bash(script1, cwd = cwd, redirect = redirect, echo = progress.verbose) |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
51 |
} |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
52 |
|
77190
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
53 |
def polyml_platform(arch_64: Boolean): String = { |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
54 |
val platform = Isabelle_Platform.self |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
55 |
(if (arch_64) platform.arch_64 else platform.arch_64_32) + "-" + platform.os_name |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
56 |
} |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
57 |
|
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
58 |
def make_polyml( |
64489 | 59 |
root: Path, |
82463
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
60 |
gmp_root: Option[Path] = None, |
64495 | 61 |
sha1_root: Option[Path] = None, |
77190
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
62 |
target_dir: Path = Path.current, |
64493 | 63 |
arch_64: Boolean = false, |
64485
e996c0a5eca9
support other bash executable (notably for msys on Windows);
wenzelm
parents:
64484
diff
changeset
|
64 |
options: List[String] = Nil, |
77190
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
65 |
mingw: MinGW = MinGW.none, |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
66 |
progress: Progress = new Progress, |
75393 | 67 |
): Unit = { |
64489 | 68 |
if (!((root + Path.explode("configure")).is_file && (root + Path.explode("PolyML")).is_dir)) |
69 |
error("Bad Poly/ML root directory: " + root) |
|
64483 | 70 |
|
72352
f4bd6f123fdf
more systematic platform support, including arm64-linux;
wenzelm
parents:
72351
diff
changeset
|
71 |
val platform = Isabelle_Platform.self |
69704 | 72 |
|
72352
f4bd6f123fdf
more systematic platform support, including arm64-linux;
wenzelm
parents:
72351
diff
changeset
|
73 |
val sha1_platform = platform.arch_64 + "-" + platform.os_name |
64493 | 74 |
|
64483 | 75 |
val info = |
72352
f4bd6f123fdf
more systematic platform support, including arm64-linux;
wenzelm
parents:
72351
diff
changeset
|
76 |
platform_info.getOrElse(platform.os_name, |
f4bd6f123fdf
more systematic platform support, including arm64-linux;
wenzelm
parents:
72351
diff
changeset
|
77 |
error("Bad OS platform: " + quote(platform.os_name))) |
64483 | 78 |
|
79499
d117821a5e82
always use patchelf on Linux: base-line is Ubuntu 18.04 where that works properly (see also e79294c4230c);
wenzelm
parents:
78775
diff
changeset
|
79 |
if (platform.is_linux) Isabelle_System.require_command("patchelf") |
70977 | 80 |
|
64491 | 81 |
|
82463
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
82 |
/* configure and make */ |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
83 |
|
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
84 |
val configure_options = { |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
85 |
val options1 = if (gmp_root.nonEmpty) List("--with-gmp") else List("--without-gmp") |
64495 | 86 |
|
82463
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
87 |
val options2 = |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
88 |
for (opt <- info.options) yield { |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
89 |
if (opt.startsWith("CFLAGS=") && gmp_root.nonEmpty) { |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
90 |
val root0 = gmp_root.get.absolute |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
91 |
val root1 = mingw.standard_path(root0) |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
92 |
require(root0.implode == File.bash_path(root0), "Bad directory name " + root0) |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
93 |
opt + " " + "-I" + root1 + "/include -L" + root1 + "/lib" |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
94 |
} |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
95 |
else opt |
73672
70d3c7009a65
proper support for macOS/Rosetta: let "uname -m" report arm64 instead of x86_64;
wenzelm
parents:
73667
diff
changeset
|
96 |
} |
82463
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
97 |
|
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
98 |
val options3 = if (arch_64) Nil else List("--enable-compact32bit") |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
99 |
|
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
100 |
List("--disable-shared", "--enable-intinf-as-int") ::: |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
101 |
options1 ::: options2 ::: options ::: options3 |
64504 | 102 |
} |
64495 | 103 |
|
82463
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
104 |
bash(root, platform, mingw, |
64487 | 105 |
info.setup + "\n" + |
64485
e996c0a5eca9
support other bash executable (notably for msys on Windows);
wenzelm
parents:
64484
diff
changeset
|
106 |
""" |
e996c0a5eca9
support other bash executable (notably for msys on Windows);
wenzelm
parents:
64484
diff
changeset
|
107 |
[ -f Makefile ] && make distclean |
e996c0a5eca9
support other bash executable (notably for msys on Windows);
wenzelm
parents:
64484
diff
changeset
|
108 |
{ |
e996c0a5eca9
support other bash executable (notably for msys on Windows);
wenzelm
parents:
64484
diff
changeset
|
109 |
./configure --prefix="$PWD/target" """ + Bash.strings(configure_options) + """ |
e996c0a5eca9
support other bash executable (notably for msys on Windows);
wenzelm
parents:
64484
diff
changeset
|
110 |
rm -rf target |
74635 | 111 |
make && make install |
64485
e996c0a5eca9
support other bash executable (notably for msys on Windows);
wenzelm
parents:
64484
diff
changeset
|
112 |
} || { echo "Build failed" >&2; exit 2; } |
82463
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
113 |
""", redirect = true, progress = progress).check |
64485
e996c0a5eca9
support other bash executable (notably for msys on Windows);
wenzelm
parents:
64484
diff
changeset
|
114 |
|
64491 | 115 |
|
64495 | 116 |
/* sha1 library */ |
117 |
||
118 |
val sha1_files = |
|
119 |
if (sha1_root.isDefined) { |
|
120 |
val dir1 = sha1_root.get |
|
82463
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
121 |
bash(dir1, platform, mingw, "./build " + sha1_platform, redirect = true, |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
122 |
progress = progress).check |
64505 | 123 |
|
72352
f4bd6f123fdf
more systematic platform support, including arm64-linux;
wenzelm
parents:
72351
diff
changeset
|
124 |
val dir2 = dir1 + Path.explode(sha1_platform) |
72462
7c552a256ca5
misc tuning and clarification: prefer Executable.libraries_closure;
wenzelm
parents:
72455
diff
changeset
|
125 |
File.read_dir(dir2).map(entry => dir2 + Path.basic(entry)) |
64495 | 126 |
} |
127 |
else Nil |
|
128 |
||
129 |
||
72462
7c552a256ca5
misc tuning and clarification: prefer Executable.libraries_closure;
wenzelm
parents:
72455
diff
changeset
|
130 |
/* install */ |
64484 | 131 |
|
77190
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
132 |
val platform_path = Path.explode(polyml_platform(arch_64)) |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
133 |
|
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
134 |
val platform_dir = target_dir + platform_path |
72462
7c552a256ca5
misc tuning and clarification: prefer Executable.libraries_closure;
wenzelm
parents:
72455
diff
changeset
|
135 |
Isabelle_System.rm_tree(platform_dir) |
7c552a256ca5
misc tuning and clarification: prefer Executable.libraries_closure;
wenzelm
parents:
72455
diff
changeset
|
136 |
Isabelle_System.make_directory(platform_dir) |
64483 | 137 |
|
77190
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
138 |
val root_platform_dir = Isabelle_System.make_directory(root + platform_path) |
64483 | 139 |
for { |
64484 | 140 |
d <- List("target/bin", "target/lib") |
64489 | 141 |
dir = root + Path.explode(d) |
64483 | 142 |
entry <- File.read_dir(dir) |
77190
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
143 |
} Isabelle_System.move_file(dir + Path.explode(entry), root_platform_dir) |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
144 |
|
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
145 |
Isabelle_System.copy_dir(root_platform_dir, platform_dir, direct = true) |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
146 |
for (file <- sha1_files) Isabelle_System.copy_file(file, platform_dir) |
67584 | 147 |
|
72469 | 148 |
Executable.libraries_closure( |
149 |
platform_dir + Path.basic("poly").platform_exe, mingw = mingw, filter = info.libs) |
|
150 |
||
67584 | 151 |
|
152 |
/* polyc: directory prefix */ |
|
153 |
||
72378 | 154 |
val Header = "#! */bin/sh".r |
75205 | 155 |
File.change_lines(platform_dir + Path.explode("polyc")) { |
156 |
case Header() :: lines => |
|
157 |
val lines1 = |
|
158 |
lines.map(line => |
|
159 |
if (line.startsWith("prefix=")) "prefix=\"$(cd \"$(dirname \"$0\")\"; pwd)\"" |
|
160 |
else if (line.startsWith("BINDIR=")) "BINDIR=\"$prefix\"" |
|
161 |
else if (line.startsWith("LIBDIR=")) "LIBDIR=\"$prefix\"" |
|
162 |
else line) |
|
163 |
"#!/usr/bin/env bash" :: lines1 |
|
164 |
case lines => |
|
165 |
error(cat_lines("Cannot patch polyc -- undetected header:" :: lines.take(3))) |
|
75202 | 166 |
} |
64483 | 167 |
} |
168 |
||
169 |
||
64496 | 170 |
|
65880 | 171 |
/** skeleton for component **/ |
172 |
||
82463
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
173 |
val standard_gmp_url = "https://gmplib.org/download/gmp/gmp-6.3.0.tar.bz2" |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
174 |
|
77190
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
175 |
val default_polyml_url = "https://github.com/polyml/polyml/archive" |
78774 | 176 |
val default_polyml_version = "90c0dbb2514e" |
177 |
val default_polyml_name = "polyml-5.9.1" |
|
71396
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
178 |
|
77190
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
179 |
val default_sha1_url = "https://isabelle.sketis.net/repos/sha1/archive" |
78775 | 180 |
val default_sha1_version = "0ce12663fe76" |
71396
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
181 |
|
77191 | 182 |
private def init_src_root(src_dir: Path, input: String, output: String): Unit = { |
183 |
val lines = split_lines(File.read(src_dir + Path.explode(input))) |
|
71396
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
184 |
val ml_files = |
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
185 |
for { |
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
186 |
line <- lines |
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
187 |
rest <- Library.try_unprefix("use", line) |
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
188 |
} yield "ML_file" + rest |
65880 | 189 |
|
77191 | 190 |
File.write(src_dir + Path.explode(output), |
71396
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
191 |
"""(* Poly/ML Compiler root file. |
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
192 |
|
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
193 |
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
|
194 |
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
|
195 |
not affect the running ML session. *) |
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
196 |
""" + ml_files.mkString("\n", "\n", "\n")) |
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
197 |
} |
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
198 |
|
77190
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
199 |
|
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
200 |
def build_polyml( |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
201 |
options: List[String] = Nil, |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
202 |
mingw: MinGW = MinGW.none, |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
203 |
component_name: String = "", |
82463
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
204 |
gmp_url: String = "", |
77190
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
205 |
polyml_url: String = default_polyml_url, |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
206 |
polyml_version: String = default_polyml_version, |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
207 |
polyml_name: String = default_polyml_name, |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
208 |
sha1_url: String = default_sha1_url, |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
209 |
sha1_version: String = default_sha1_version, |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
210 |
target_dir: Path = Path.current, |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
211 |
progress: Progress = new Progress |
75393 | 212 |
): Unit = { |
82463
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
213 |
val platform = Isabelle_Platform.self |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
214 |
|
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
215 |
|
77190
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
216 |
/* component */ |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
217 |
|
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
218 |
val component_name1 = if (component_name.isEmpty) "polyml-" + polyml_version else component_name |
81927 | 219 |
val component_dir = |
220 |
Components.Directory(target_dir + Path.basic(component_name1)).create(progress = progress) |
|
77190
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
221 |
|
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
222 |
|
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
223 |
/* download and build */ |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
224 |
|
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
225 |
Isabelle_System.with_tmp_dir("download") { download_dir => |
82463
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
226 |
/* GMP library */ |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
227 |
|
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
228 |
val gmp_root: Option[Path] = |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
229 |
if (gmp_url.isEmpty) None |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
230 |
else { |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
231 |
val gmp_dir = Isabelle_System.make_directory(download_dir + Path.basic("gmp")) |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
232 |
|
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
233 |
val archive_name = |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
234 |
Url.get_base_name(gmp_url).getOrElse(error("No base name in " + quote(gmp_url))) |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
235 |
val archive = download_dir + Path.basic(archive_name) |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
236 |
Isabelle_System.download_file(gmp_url, archive, progress = progress) |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
237 |
Isabelle_System.extract(archive, gmp_dir, strip = true) |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
238 |
|
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
239 |
val platform_arch = if (platform.is_arm) "aarch64" else "x86_64" |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
240 |
val platform_os = |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
241 |
if (platform.is_linux) "unknown-linux-gnu" |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
242 |
else if (platform.is_windows) "w64-mingw32" |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
243 |
else if (platform.is_macos) """apple-darwin"$(uname -r)"""" |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
244 |
else error("Bad platform " + platform) |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
245 |
|
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
246 |
progress.echo("Building GMP library ...") |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
247 |
bash(gmp_dir, platform, mingw, progress = progress, |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
248 |
script = Library.make_lines( |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
249 |
"set -e", |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
250 |
"./configure --enable-cxx --build=" + platform_arch + "-" + platform_os + |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
251 |
""" --prefix="$PWD/target"""", |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
252 |
"make", |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
253 |
"make check", |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
254 |
"make install" |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
255 |
)).check |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
256 |
|
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
257 |
Some(gmp_dir + Path.explode("target")) |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
258 |
} |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
259 |
|
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
260 |
|
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
261 |
/* Poly/ML */ |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
262 |
|
77190
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
263 |
val List(polyml_download, sha1_download) = |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
264 |
for { |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
265 |
(url, version, target) <- |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
266 |
List((polyml_url, polyml_version, "src"), (sha1_url, sha1_version, "sha1")) |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
267 |
} yield { |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
268 |
val remote = Url.append_path(url, version + ".tar.gz") |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
269 |
val download = download_dir + Path.basic(version) |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
270 |
Isabelle_System.download_file(remote, download.tar.gz, progress = progress) |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
271 |
Isabelle_System.extract(download.tar.gz, download, strip = true) |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
272 |
Isabelle_System.extract( |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
273 |
download.tar.gz, component_dir.path + Path.basic(target), strip = true) |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
274 |
download |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
275 |
} |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
276 |
|
77191 | 277 |
init_src_root(component_dir.src, "RootArm64.ML", "ROOT0.ML") |
278 |
init_src_root(component_dir.src, "RootX86.ML", "ROOT.ML") |
|
77190
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
279 |
|
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
280 |
for (arch_64 <- List(false, true)) { |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
281 |
progress.echo("Building " + polyml_platform(arch_64)) |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
282 |
make_polyml( |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
283 |
root = polyml_download, |
82463
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
284 |
gmp_root = gmp_root, |
77190
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
285 |
sha1_root = Some(sha1_download), |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
286 |
target_dir = component_dir.path, |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
287 |
arch_64 = arch_64, |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
288 |
options = options, |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
289 |
mingw = mingw, |
77510
f5d6cd98b16a
clarified signature: manage "verbose" flag via "progress";
wenzelm
parents:
77191
diff
changeset
|
290 |
progress = if (progress.verbose) progress else new Progress) |
77190
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
291 |
} |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
292 |
} |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
293 |
|
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
294 |
|
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
295 |
/* settings */ |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
296 |
|
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
297 |
component_dir.write_settings("""# -*- shell-script -*- :mode=shellscript: |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
298 |
|
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
299 |
POLYML_HOME="$COMPONENT" |
71396
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
300 |
|
77190
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
301 |
if [ -n "$ISABELLE_APPLE_PLATFORM64" ] |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
302 |
then |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
303 |
if grep "ML_system_apple.*=.*false" "$ISABELLE_HOME_USER/etc/preferences" >/dev/null 2>/dev/null |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
304 |
then |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
305 |
ML_PLATFORM="$ISABELLE_PLATFORM64" |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
306 |
else |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
307 |
ML_PLATFORM="$ISABELLE_APPLE_PLATFORM64" |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
308 |
fi |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
309 |
else |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
310 |
ML_PLATFORM="${ISABELLE_WINDOWS_PLATFORM64:-$ISABELLE_PLATFORM64}" |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
311 |
fi |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
312 |
|
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
313 |
if grep "ML_system_64.*=.*true" "$ISABELLE_HOME_USER/etc/preferences" >/dev/null 2>/dev/null |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
314 |
then |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
315 |
ML_OPTIONS="--minheap 1000" |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
316 |
else |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
317 |
ML_PLATFORM="${ML_PLATFORM/64/64_32}" |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
318 |
ML_OPTIONS="--minheap 500" |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
319 |
fi |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
320 |
|
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
321 |
ML_SYSTEM=""" + Bash.string(polyml_name) + """ |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
322 |
ML_HOME="$POLYML_HOME/$ML_PLATFORM" |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
323 |
ML_SOURCES="$POLYML_HOME/src" |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
324 |
|
77191 | 325 |
case "$ML_PLATFORM" in |
326 |
*arm64*) |
|
327 |
ISABELLE_DOCS_EXAMPLES="$ISABELLE_DOCS_EXAMPLES:\$ML_SOURCES/ROOT0.ML" |
|
328 |
;; |
|
329 |
*) |
|
330 |
ISABELLE_DOCS_EXAMPLES="$ISABELLE_DOCS_EXAMPLES:\$ML_SOURCES/ROOT.ML" |
|
331 |
;; |
|
332 |
esac |
|
77190
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
333 |
""") |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
334 |
|
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
335 |
|
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
336 |
/* README */ |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
337 |
|
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
338 |
File.write(component_dir.README, |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
339 |
"""Poly/ML for Isabelle |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
340 |
==================== |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
341 |
|
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
342 |
This compilation of Poly/ML (https://www.polyml.org) is based on the |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
343 |
source distribution from |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
344 |
https://github.com/polyml/polyml/commit/""" + polyml_version + """ |
64483 | 345 |
|
78774 | 346 |
This coincides with the official release of Poly/ML 5.9.1, see also |
347 |
https://github.com/polyml/polyml/releases/tag/v5.9.1 |
|
348 |
||
77190
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
349 |
The Isabelle repository provides an administrative tool "isabelle |
78482 | 350 |
component_polyml", which can be used in the polyml component directory as |
351 |
follows: |
|
77190
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
352 |
|
78482 | 353 |
* Linux and macOS |
77190
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
354 |
|
82463
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
355 |
$ isabelle component_polyml -G: |
77190
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
356 |
|
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
357 |
* Windows (Cygwin shell) |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
358 |
|
82463
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
359 |
$ isabelle component_polyml -G: -M /cygdrive/c/msys64 |
77190
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
360 |
|
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
361 |
|
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
362 |
Makarius |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
363 |
""" + Date.Format.date(Date.now()) + "\n") |
65880 | 364 |
} |
365 |
||
366 |
||
367 |
||
368 |
/** Isabelle tool wrappers **/ |
|
369 |
||
370 |
val isabelle_tool1 = |
|
77190
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
371 |
Isabelle_Tool("make_polyml", "make Poly/ML from existing sources", Scala_Project.here, |
75394 | 372 |
{ args => |
82463
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
373 |
var gmp_root: Option[Path] = None |
75394 | 374 |
var mingw = MinGW.none |
375 |
var arch_64 = false |
|
376 |
var sha1_root: Option[Path] = None |
|
64483 | 377 |
|
75394 | 378 |
val getopts = Getopts(""" |
77190
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
379 |
Usage: isabelle make_polyml [OPTIONS] ROOT [CONFIGURE_OPTIONS] |
64483 | 380 |
|
381 |
Options are: |
|
82463
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
382 |
-G DIR GMP library root |
72429 | 383 |
-M DIR msys/mingw root specification for Windows |
72352
f4bd6f123fdf
more systematic platform support, including arm64-linux;
wenzelm
parents:
72351
diff
changeset
|
384 |
-m ARCH processor architecture (32 or 64, default: """ + |
f4bd6f123fdf
more systematic platform support, including arm64-linux;
wenzelm
parents:
72351
diff
changeset
|
385 |
(if (arch_64) "64" else "32") + """) |
69691 | 386 |
-s DIR sha1 sources, see https://isabelle.sketis.net/repos/sha1 |
64483 | 387 |
|
77190
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
388 |
Make Poly/ML in the ROOT directory of its sources, with additional |
82463
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
389 |
CONFIGURE_OPTIONS. |
64483 | 390 |
""", |
82463
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
391 |
"G:" -> (arg => gmp_root = Some(Path.explode(arg))), |
75394 | 392 |
"M:" -> (arg => mingw = MinGW(Path.explode(arg))), |
393 |
"m:" -> |
|
394 |
{ |
|
395 |
case "32" => arch_64 = false |
|
396 |
case "64" => arch_64 = true |
|
397 |
case bad => error("Bad processor architecture: " + quote(bad)) |
|
398 |
}, |
|
399 |
"s:" -> (arg => sha1_root = Some(Path.explode(arg)))) |
|
64483 | 400 |
|
75394 | 401 |
val more_args = getopts(args) |
402 |
val (root, options) = |
|
403 |
more_args match { |
|
404 |
case root :: options => (Path.explode(root), options) |
|
405 |
case Nil => getopts.usage() |
|
406 |
} |
|
82463
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
407 |
make_polyml(root, gmp_root = gmp_root, sha1_root = sha1_root, |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
408 |
progress = new Console_Progress, arch_64 = arch_64, options = options, mingw = mingw) |
75394 | 409 |
}) |
65880 | 410 |
|
411 |
val isabelle_tool2 = |
|
77566
2a99fcb283ee
renamed administrative tools to build Isabelle components (unrelated to "isabelle build");
wenzelm
parents:
77510
diff
changeset
|
412 |
Isabelle_Tool("component_polyml", "build Poly/ML component from official repository", |
75394 | 413 |
Scala_Project.here, |
414 |
{ args => |
|
77190
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
415 |
var target_dir = Path.current |
82463
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
416 |
var gmp_url = "" |
77190
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
417 |
var mingw = MinGW.none |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
418 |
var component_name = "" |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
419 |
var sha1_url = default_sha1_url |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
420 |
var sha1_version = default_sha1_version |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
421 |
var polyml_url = default_polyml_url |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
422 |
var polyml_version = default_polyml_version |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
423 |
var polyml_name = default_polyml_name |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
424 |
var verbose = false |
82463
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
425 |
|
75394 | 426 |
val getopts = Getopts(""" |
77566
2a99fcb283ee
renamed administrative tools to build Isabelle components (unrelated to "isabelle build");
wenzelm
parents:
77510
diff
changeset
|
427 |
Usage: isabelle component_polyml [OPTIONS] [CONFIGURE_OPTIONS] |
65880 | 428 |
|
429 |
Options are: |
|
77190
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
430 |
-D DIR target directory (default ".") |
82463
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
431 |
-G URL build GMP library from source: explicit URL or ":" for |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
432 |
""" + standard_gmp_url + """ |
77190
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
433 |
-M DIR msys/mingw root specification for Windows |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
434 |
-N NAME component name (default: derived from Poly/ML version) |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
435 |
-S URL SHA1 repository archive area |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
436 |
(default: """ + quote(default_sha1_url) + """) |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
437 |
-T VERSION SHA1 version (default: """ + quote(default_sha1_version) + """) |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
438 |
-U URL Poly/ML repository archive area |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
439 |
(default: """ + quote(default_polyml_url) + """) |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
440 |
-V VERSION Poly/ML version (default: """ + quote(default_polyml_version) + """) |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
441 |
-W NAME Poly/ML name (default: """ + quote(default_polyml_name) + """) |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
442 |
-v verbose |
65880 | 443 |
|
77190
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
444 |
Download and build Poly/ML component from source repositories, with additional |
82463
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
445 |
CONFIGURE_OPTIONS. |
77190
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
446 |
""", |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
447 |
"D:" -> (arg => target_dir = Path.explode(arg)), |
82463
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
448 |
"G:" -> (arg => gmp_url = if (arg == ":") standard_gmp_url else arg), |
77190
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
449 |
"M:" -> (arg => mingw = MinGW(Path.explode(arg))), |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
450 |
"N:" -> (arg => component_name = arg), |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
451 |
"S:" -> (arg => sha1_url = arg), |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
452 |
"T:" -> (arg => sha1_version = arg), |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
453 |
"U:" -> (arg => polyml_url = arg), |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
454 |
"V:" -> (arg => polyml_version = arg), |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
455 |
"W:" -> (arg => polyml_name = arg), |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
456 |
"v" -> (_ => verbose = true)) |
71396
c1c61d0d8e7c
clarified build_polyml_component: include IDE entry point for ML compiler;
wenzelm
parents:
71117
diff
changeset
|
457 |
|
77190
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
458 |
val options = getopts(args) |
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
459 |
|
77510
f5d6cd98b16a
clarified signature: manage "verbose" flag via "progress";
wenzelm
parents:
77191
diff
changeset
|
460 |
val progress = new Console_Progress(verbose = verbose) |
77190
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
461 |
|
f6ba88f23135
clarified "isabelle build_polyml": download and build everything for current platform;
wenzelm
parents:
76547
diff
changeset
|
462 |
build_polyml(options = options, mingw = mingw, component_name = component_name, |
82463
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
463 |
gmp_url = gmp_url, polyml_url = polyml_url, polyml_version = polyml_version, |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
464 |
polyml_name = polyml_name, sha1_url = sha1_url, sha1_version = sha1_version, |
3125fd1ee69c
added option -G to build GMP library from sources;
wenzelm
parents:
82142
diff
changeset
|
465 |
target_dir = target_dir, progress = progress) |
75394 | 466 |
}) |
64483 | 467 |
} |