-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathacl2.cmd
executable file
·143 lines (117 loc) · 3.67 KB
/
acl2.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
::/*#! 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._
def usage(): Unit = {
println("Usage: [<num-of-cores>]")
}
val homeBin: Os.Path = Os.slashDir.up.canon
var cores: Z = 4
val cacheDir: Os.Path = Os.env("SIREUM_CACHE") match {
case Some(dir) => Os.path(dir)
case _ => Os.home / "Downloads" / "sireum"
}
def ccl(p: String): Unit = {
val cclVersion = "1.13"
val cclUrlPrefix = s"https://github.com/Clozure/ccl/releases/download/v$cclVersion/"
val cclBundleMap: Map[String, String] = Map.empty[String, String] ++ ISZ(
"linux" ~> s"ccl-$cclVersion-linuxx86.tar.gz",
"mac" ~> s"ccl-$cclVersion-darwinx86.tar.gz"
)
val appDir = Os.home / "Applications"
val cclDir = appDir / "ccl"
val platformDir = homeBin / p
val ver = platformDir / "ccl" / "VER"
if (ver.exists && ver.read == cclVersion) {
return
}
appDir.mkdirAll()
val bundle = cclBundleMap.get(p).get
val cache = cacheDir / bundle
if (!cache.exists) {
cache.up.mkdirAll()
println(s"Downloading Clozure Common Lisp $cclVersion ...")
cache.downloadFrom(s"$cclUrlPrefix/$bundle")
}
if (cclDir.exists) {
cclDir.removeAll()
}
println(s"Extracting $cache ...")
Os.proc(ISZ("tar", "xfz", cache.string)).at(appDir).console.runCheck()
platformDir.mkdirAll()
(platformDir / "ccl").removeAll()
proc"ln -s $cclDir .".at(platformDir).runCheck()
ver.writeOver(cclVersion)
}
def acl2(p: String): Unit = {
ccl(p)
val acl2Version = "8.6"
val acl2UrlPrefix = s"https://github.com/acl2-devel/acl2-devel/releases/download/$acl2Version/"
val appDir = Os.home / "Applications"
val acl2Dir = appDir / "acl2"
val cclExe = appDir / "ccl" / (if (p == "linux") "lx86cl64" else "dx86cl64")
val platformDir = homeBin / p
val ver = platformDir / "acl2" / "VER"
if (ver.exists && ver.read == acl2Version) {
return
}
val bundle = s"acl2-$acl2Version.tar.gz"
val cache = cacheDir / bundle
if (!cache.exists) {
cache.up.mkdirAll()
println(s"Downloading acl2 $acl2Version ...")
cache.downloadFrom(s"$acl2UrlPrefix/$bundle")
}
if (acl2Dir.exists) {
acl2Dir.removeAll()
}
println(s"Extracting $cache ...")
Os.proc(ISZ("tar", "xfz", cache.string)).at(appDir).console.runCheck()
(appDir / s"acl2-$acl2Version").moveTo(acl2Dir)
platformDir.mkdirAll()
(platformDir / "acl2").removeAll()
proc"ln -s $acl2Dir .".at(platformDir).runCheck()
val acl2 = acl2Dir / "saved_acl2"
println(s"Creating $acl2 ...")
Os.proc(ISZ("make", s"LISP=$cclExe")).at(acl2Dir).console.runCheck()
println(s"Certifying acl2 books ...")
Os.proc(ISZ("make", s"ACL2=$acl2", "-j", cores.string, "all")).at(acl2Dir / "books").console.runCheck()
ver.writeOver(acl2Version)
println(s"... done! ACL2 is installed at $acl2Dir")
}
def platform(p: String): Unit = {
p match {
case string"mac" =>
case string"linux" =>
case string"-h" =>
usage()
return
case _ =>
eprintln("Unsupported platform")
usage()
Os.exit(-1)
}
acl2(p)
}
if (Os.cliArgs.nonEmpty) {
Z(Os.cliArgs(0)) match {
case Some(n) => cores = n
case _ =>
}
}
Os.kind match {
case Os.Kind.Mac =>
val isArm: B = ops.StringOps(proc"uname -m".runCheck().out).trim == "arm64"
platform(if (isArm) "???" else "mac")
case Os.Kind.Linux => platform("linux")
case Os.Kind.Win => platform("win")
case _ => platform("???")
}