author | wenzelm |
Tue, 06 May 2025 16:52:39 +0200 | |
changeset 82610 | 3133f9748ea8 |
parent 82277 | 1a8aa332548b |
permissions | -rw-r--r-- |
79874 | 1 |
/* Title: Pure/Admin/component_windows_app.scala |
79569
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
2 |
Author: Makarius |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
3 |
|
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
4 |
Build Isabelle windows_app component from GNU binutils and launch4j. |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
5 |
*/ |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
6 |
|
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
7 |
package isabelle |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
8 |
|
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
9 |
|
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
10 |
object Component_Windows_App { |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
11 |
/* resources */ |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
12 |
|
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
13 |
def tool_platform(): String = { |
79577
1c63babf226e
uniform build of binutils for linux, linux_arm, macos;
wenzelm
parents:
79574
diff
changeset
|
14 |
require(Platform.is_unix, "Linux or macOS platform required") |
82610 | 15 |
Isabelle_Platform.local.ISABELLE_PLATFORM64 |
79569
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
16 |
} |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
17 |
|
82277
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
18 |
def tool_platform_path(): Path = Path.basic(tool_platform()) |
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
19 |
|
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
20 |
val base_path: Path = Path.basic("windows_app") |
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
21 |
|
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
22 |
def launch4j_jar(base: Path = base_path): Path = |
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
23 |
base + tool_platform_path() + Path.basic("launch4j.jar") |
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
24 |
|
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
25 |
def seven_zip(base: Path = base_path, exe: Boolean = false): Path = |
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
26 |
base + tool_platform_path() + Path.basic("7zip") + |
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
27 |
(if (exe) Path.basic("7zz") else Path.current) |
79569
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
28 |
|
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
29 |
val sfx_name = "7zsd_All_x64.sfx" |
82277
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
30 |
val sfx_path: Path = base_path + Path.basic(sfx_name) |
79569
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
31 |
|
82194 | 32 |
val sfx_txt = |
33 |
""";!@Install@!UTF-8! |
|
34 |
GUIFlags="64" |
|
35 |
InstallPath="%UserDesktop%" |
|
36 |
BeginPrompt="Unpack {ISABELLE_NAME}?" |
|
37 |
ExtractPathText="Target directory" |
|
38 |
ExtractTitle="Unpacking {ISABELLE_NAME} ..." |
|
39 |
Shortcut="Du,{%%T\{ISABELLE_NAME}\{ISABELLE_NAME}.exe},{},{},{},{{ISABELLE_NAME}},{%%T\{ISABELLE_NAME}}" |
|
40 |
RunProgram="\"%%T\{ISABELLE_NAME}\{ISABELLE_NAME}.exe\"" |
|
41 |
AutoInstall="\"%%T\{ISABELLE_NAME}\{ISABELLE_NAME}.exe\" -init" |
|
42 |
;!@InstallEnd@! |
|
43 |
""" |
|
44 |
||
79569
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
45 |
|
82277
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
46 |
/* 7zip platform downloads */ |
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
47 |
|
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
48 |
sealed case class Seven_Zip_Platform(name: String, url_template: String) { |
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
49 |
def url(version: String): String = url_template.replace("{V}", version) |
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
50 |
} |
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
51 |
|
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
52 |
private val seven_zip_platforms: List[Seven_Zip_Platform] = |
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
53 |
List( |
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
54 |
Seven_Zip_Platform("arm64-linux", "https://www.7-zip.org/a/7z{V}-linux-arm64.tar.xz"), |
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
55 |
Seven_Zip_Platform("x86_64-darwin", "https://www.7-zip.org/a/7z{V}-mac.tar.xz"), |
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
56 |
Seven_Zip_Platform("x86_64-linux", "https://www.7-zip.org/a/7z{V}-linux-x64.tar.xz")) |
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
57 |
|
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
58 |
|
79569
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
59 |
/* build windows_app */ |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
60 |
|
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
61 |
val default_launch4j_url = |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
62 |
"https://deac-riga.dl.sourceforge.net/project/launch4j/launch4j-3/3.50/launch4j-3.50-linux-x64.tgz" |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
63 |
|
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
64 |
val default_binutils_url = |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
65 |
"https://ftp.gnu.org/gnu/binutils/binutils-2.26.1.tar.gz" |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
66 |
|
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
67 |
val default_sfx_url = |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
68 |
"https://github.com/chrislake/7zsfxmm/releases/download/1.7.1.3901/7zsd_extra_171_3901.7z" |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
69 |
|
82277
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
70 |
val default_seven_zip_version = "2409" |
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
71 |
|
79569
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
72 |
def build_windows_app( |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
73 |
launch4j_url: String = default_launch4j_url, |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
74 |
binutils_url: String = default_binutils_url, |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
75 |
sfx_url: String = default_sfx_url, |
82277
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
76 |
seven_zip_version: String = default_seven_zip_version, |
79569
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
77 |
progress: Progress = new Progress, |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
78 |
target_dir: Path = Path.current |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
79 |
): Unit = { |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
80 |
val platform_name = tool_platform() |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
81 |
|
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
82 |
Isabelle_System.with_tmp_dir("build") { tmp_dir => |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
83 |
val download_tar = tmp_dir + Path.basic("download.tar.gz") |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
84 |
|
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
85 |
|
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
86 |
/* component */ |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
87 |
|
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
88 |
val component_dir = Components.Directory(tmp_dir + Path.basic("windows_app")).create() |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
89 |
|
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
90 |
val platform_dir = |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
91 |
Isabelle_System.make_directory(component_dir.path + Path.basic(platform_name)) |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
92 |
|
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
93 |
val platform_bin_dir = platform_dir + Path.basic("bin") |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
94 |
|
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
95 |
|
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
96 |
/* launch4j */ |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
97 |
|
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
98 |
Isabelle_System.download_file(launch4j_url, download_tar, progress = progress) |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
99 |
Isabelle_System.extract(download_tar, platform_dir, strip = true) |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
100 |
|
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
101 |
|
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
102 |
/* GNU binutils */ |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
103 |
|
79577
1c63babf226e
uniform build of binutils for linux, linux_arm, macos;
wenzelm
parents:
79574
diff
changeset
|
104 |
Isabelle_System.download_file(binutils_url, download_tar, progress = progress) |
1c63babf226e
uniform build of binutils for linux, linux_arm, macos;
wenzelm
parents:
79574
diff
changeset
|
105 |
Isabelle_System.extract(download_tar, tmp_dir, strip = true) |
79569
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
106 |
|
79577
1c63babf226e
uniform build of binutils for linux, linux_arm, macos;
wenzelm
parents:
79574
diff
changeset
|
107 |
progress.echo("Building GNU binutils for " + platform_name + " ...") |
1c63babf226e
uniform build of binutils for linux, linux_arm, macos;
wenzelm
parents:
79574
diff
changeset
|
108 |
val build_script = |
79579 | 109 |
List("""./configure --prefix="$PWD/target" --target=x86_64-w64-mingw32""", |
79577
1c63babf226e
uniform build of binutils for linux, linux_arm, macos;
wenzelm
parents:
79574
diff
changeset
|
110 |
"make", "make install") |
80224
db92e0b6a11a
clarified signature: prefer symbolic isabelle.Path over physical java.io.File;
wenzelm
parents:
79874
diff
changeset
|
111 |
Isabelle_System.bash(build_script.mkString(" && "), cwd = tmp_dir, |
79577
1c63babf226e
uniform build of binutils for linux, linux_arm, macos;
wenzelm
parents:
79574
diff
changeset
|
112 |
progress_stdout = progress.echo(_, verbose = true), |
1c63babf226e
uniform build of binutils for linux, linux_arm, macos;
wenzelm
parents:
79574
diff
changeset
|
113 |
progress_stderr = progress.echo(_, verbose = true)).check |
79569
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
114 |
|
79577
1c63babf226e
uniform build of binutils for linux, linux_arm, macos;
wenzelm
parents:
79574
diff
changeset
|
115 |
for (name <- List("ld", "windres")) { |
1c63babf226e
uniform build of binutils for linux, linux_arm, macos;
wenzelm
parents:
79574
diff
changeset
|
116 |
Isabelle_System.copy_file( |
1c63babf226e
uniform build of binutils for linux, linux_arm, macos;
wenzelm
parents:
79574
diff
changeset
|
117 |
tmp_dir + Path.explode("target/bin") + Path.basic("x86_64-w64-mingw32-" + name), |
1c63babf226e
uniform build of binutils for linux, linux_arm, macos;
wenzelm
parents:
79574
diff
changeset
|
118 |
platform_bin_dir + Path.basic(name)) |
79569
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
119 |
} |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
120 |
|
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
121 |
|
82277
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
122 |
/* 7zip tool */ |
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
123 |
|
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
124 |
seven_zip_platforms.find(platform => platform.name == platform_name) match { |
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
125 |
case Some(platform) => |
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
126 |
val url = platform.url(seven_zip_version) |
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
127 |
val name = Url.get_base_name(url).getOrElse(error("No base name in " + quote(url))) |
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
128 |
val download = tmp_dir + Path.basic(name) |
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
129 |
Isabelle_System.download_file(url, download, progress = progress) |
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
130 |
Isabelle_System.extract(download, |
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
131 |
Isabelle_System.make_directory(seven_zip(base = component_dir.path))) |
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
132 |
case None => error("No 7zip for platform " + quote(platform_name)) |
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
133 |
} |
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
134 |
|
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
135 |
|
79569
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
136 |
/* 7zip sfx module */ |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
137 |
|
79572 | 138 |
val sfx_archive_name = Url.get_base_name(sfx_url).get |
79569
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
139 |
|
79572 | 140 |
Isabelle_System.download_file(sfx_url, |
141 |
tmp_dir + Path.basic(sfx_archive_name), progress = progress) |
|
82277
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
142 |
Isabelle_System.bash( |
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
143 |
File.bash_path(seven_zip(base = component_dir.path, exe = true)) + " x " + |
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
144 |
Bash.string(sfx_archive_name), cwd = tmp_dir).check |
79569
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
145 |
Isabelle_System.copy_file(tmp_dir + Path.basic(sfx_name), component_dir.path) |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
146 |
|
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
147 |
|
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
148 |
/* README */ |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
149 |
|
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
150 |
File.write(component_dir.README, |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
151 |
"""Auxiliary parts for Isabelle as Windows application |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
152 |
=================================================== |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
153 |
|
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
154 |
* Application launcher: http://launch4j.sourceforge.net |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
155 |
|
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
156 |
* Platform binaries "ld" and "windres" from GNU binutils: |
79578 | 157 |
""" + binutils_url + build_script.mkString("\n\n ", "\n ", "") + """ |
79569
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
158 |
|
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
159 |
* Self-extracting installer: |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
160 |
""" + sfx_url + """ |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
161 |
|
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
162 |
See also Isabelle/Admin/Windows/. |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
163 |
|
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
164 |
|
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
165 |
Makarius |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
166 |
""" + Date.Format.date(Date.now()) + "\n") |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
167 |
|
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
168 |
|
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
169 |
/* component archive */ |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
170 |
|
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
171 |
val component_archive = |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
172 |
Isabelle_System.make_directory(target_dir) + |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
173 |
Path.basic("windows_app-" + Date.Format.alt_date(Date.now())).tar.gz |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
174 |
|
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
175 |
Isabelle_System.gnutar( |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
176 |
"-czf " + File.bash_path(component_archive) + " windows_app", dir = tmp_dir).check |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
177 |
|
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
178 |
progress.echo("Component archive " + component_archive) |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
179 |
} |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
180 |
} |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
181 |
|
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
182 |
|
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
183 |
/* Isabelle tool wrapper */ |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
184 |
|
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
185 |
val isabelle_tool = |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
186 |
Isabelle_Tool("component_windows_app", |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
187 |
"build windows_app component from GNU binutils and launch4j", |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
188 |
Scala_Project.here, |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
189 |
{ args => |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
190 |
var target_dir = Path.current |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
191 |
var launch4j_url = default_launch4j_url |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
192 |
var binutils_url = default_binutils_url |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
193 |
var sfx_url = default_sfx_url |
82277
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
194 |
var seven_zip_version = default_seven_zip_version |
79569
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
195 |
var verbose = false |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
196 |
|
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
197 |
val getopts = Getopts(""" |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
198 |
Usage: isabelle component_windows_app [OPTIONS] |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
199 |
|
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
200 |
Options are: |
79571 | 201 |
-B build GNU binutils from sources |
79569
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
202 |
-D DIR target directory (default ".") |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
203 |
-U URL download URL for launch4j, default: |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
204 |
""" + default_launch4j_url + """ |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
205 |
-V URL download URL for GNU binutils, default: |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
206 |
""" + default_binutils_url + """ |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
207 |
-W URL download URL for 7zip sfx module, default: |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
208 |
""" + default_sfx_url + """ |
82277
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
209 |
-X VERSION version for 7zip download (default: """ + default_seven_zip_version + """) |
79569
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
210 |
-v verbose |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
211 |
|
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
212 |
Build Isabelle windows_app component from GNU binutils and launch4j. |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
213 |
""", |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
214 |
"D:" -> (arg => target_dir = Path.explode(arg)), |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
215 |
"U:" -> (arg => launch4j_url = arg), |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
216 |
"V:" -> (arg => binutils_url = arg), |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
217 |
"W:" -> (arg => sfx_url = arg), |
82277
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
218 |
"X:" -> (arg => seven_zip_version = arg), |
79569
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
219 |
"v" -> (_ => verbose = true)) |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
220 |
|
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
221 |
val more_args = getopts(args) |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
222 |
if (more_args.nonEmpty) getopts.usage() |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
223 |
|
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
224 |
val progress = new Console_Progress(verbose = verbose) |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
225 |
|
79577
1c63babf226e
uniform build of binutils for linux, linux_arm, macos;
wenzelm
parents:
79574
diff
changeset
|
226 |
build_windows_app(launch4j_url = launch4j_url, binutils_url = binutils_url, |
82277
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
227 |
sfx_url = sfx_url, seven_zip_version = seven_zip_version, |
1a8aa332548b
more robust windows_app: bundle current 7z 24.09, but downgrade its output to 16.02, in order to work with old/unmaintained 7zsd_extra_171_3901.7z --- consequently, "Admin/build_release -p windows" works uniformly on Ubuntu 22.04 and 24.04;
wenzelm
parents:
82194
diff
changeset
|
228 |
progress = progress, target_dir = target_dir) |
79569
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
229 |
}) |
b5d199871f2f
build Isabelle windows_app component from GNU binutils and launch4j;
wenzelm
parents:
diff
changeset
|
230 |
} |