-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathisabelle.cmd
executable file
·85 lines (75 loc) · 2.91 KB
/
isabelle.cmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
::/*#! 2> /dev/null #
@ 2>/dev/null # 2>nul & echo off & goto BOF #
export SIREUM_HOME=$(cd -P "$(dirname "$0")/../.." && pwd -P) #
exec "${SIREUM_HOME}/bin/sireum" slang run "$0" "$@" #
:BOF
setlocal
set SIREUM_HOME=%~dp0..\..
"%SIREUM_HOME%\bin\sireum.bat" slang run %0 %*
exit /B %errorlevel%
::!#*/
// #Sireum
import org.sireum._
val version = "2024"
val homeBin: Os.Path = Os.slashDir.up.canon
val cacheDir: Os.Path = Os.env("SIREUM_CACHE") match {
case Some(dir) => Os.path(dir)
case _ => Os.home / "Downloads" / "sireum"
}
def platform(kind: Os.Kind.Type): Unit = {
val (bundle, binPlatform): (String, Os.Path) = kind match {
case Os.Kind.Mac => (s"Isabelle${version}_macos.tar.gz", homeBin / "mac")
case Os.Kind.Linux => (s"Isabelle${version}_linux.tar.gz", homeBin / "linux")
case Os.Kind.LinuxArm => (s"Isabelle${version}_linux_arm.tar.gz", homeBin / "linux" / "arm")
case Os.Kind.Win => (s"Isabelle${version}.exe", homeBin / "win")
case _ =>
println("Unsupported platform")
Os.exit(-1)
return
}
val isabelle = binPlatform / (if (kind == Os.Kind.Mac) "Isabelle.app" else "isabelle")
val ver = isabelle / "VER"
if (ver.exists && ver.read == version) {
return
}
(binPlatform / (if (kind == Os.Kind.Mac) s"Isabelle$version.app" else s"Isabelle$version")).removeAll()
isabelle.removeAll()
val cachedBundle = cacheDir / bundle
if (!cachedBundle.exists) {
println(s"Please wait while downloading Isabelle $version ...")
cachedBundle.downloadFrom(s"https://isabelle.in.tum.de/dist/$bundle")
println()
}
println(s"Extracting Isabelle $version ...")
if (kind == Os.Kind.Win) {
val p7za: Os.Path = Os.kind match {
case Os.Kind.Mac => homeBin / "mac" / "7za"
case Os.Kind.Linux => homeBin / "linux" / "7za"
case Os.Kind.LinuxArm => homeBin / "linux" / "arm" / "7za"
case Os.Kind.Win => homeBin / "win" / "7za.exe"
case _ => halt("Infeasible")
}
proc"$p7za x $cachedBundle".at(binPlatform).runCheck()
} else {
proc"tar xfz $cachedBundle".at(binPlatform).runCheck()
}
if (kind == Os.Kind.Mac) {
(binPlatform / s"Isabelle$version.app").moveTo(isabelle)
(isabelle / s"Isabelle$version").moveTo(isabelle / "Isabelle")
ver.writeOver(version)
proc"codesign --force --deep --sign - ${isabelle}".run()
} else {
(binPlatform / s"Isabelle$version").moveTo(isabelle)
if (kind == Os.Kind.Win) {
(isabelle / s"Isabelle$version.exe").moveTo(isabelle / "Isabelle.exe")
(isabelle / s"Isabelle$version.exe.manifest").moveTo(isabelle / "Isabelle.exe.manifest")
(isabelle / s"Isabelle$version.l4j.ini").moveTo(isabelle / "Isabelle.l4j.ini")
} else {
(isabelle / s"Isabelle$version").moveTo(isabelle / "Isabelle")
}
ver.writeOver(version)
}
println()
println(s"Isabelle is available at $isabelle")
}
platform(Os.kind)