-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·81 lines (70 loc) · 2.21 KB
/
install.sh
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
#!/usr/bin/env bash
# Print an error message and exit with 1
unsupported_os () {
echo "Detected OS ($1) is unsupported."
echo "Please open an issue (PRs welcome ❤️) on:"
echo " https://github.com/karnotxyz/proof-generator/issues"
echo ""
echo "NOTE: you can still try installing dependencies manually"
echo "If your OS differs from the detected one, you can look \
for the installation script for your OS in the install-scripts folder."
exit 1
}
# Print the detected OS
print_os() {
echo "Detected OS: $1"
}
# Print a message and run the script
run_script() {
echo "Running $1..."
. $1
}
install_cairo_vm() {
git clone "https://github.com/lambdaclass/cairo-vm.git" "./dependencies/cairo-vm"
./dependencies/cairo-vm/install.sh
}
# Detect Linux distro
install_linux() {
print_os "Linux"
install_cairo_vm
cd dependencies/cairo-vm || exit
make deps
cd - || exit
echo "Cairo VM installed"
# Install Stone Prover
git clone https://github.com/starkware-libs/stone-prover.git ./dependencies/stone-prover
cd dependencies/stone-prover || exit
docker build --tag prover .
container_id=$(docker create prover)
docker cp -L ${container_id}:/bin/cpu_air_prover .
docker cp -L ${container_id}:/bin/cpu_air_verifier .
cd - || exit
echo "Stone Prover installed"
}
install_macos() {
print_os "MacOS"
# Install Cairo VM
install_cairo_vm
cd dependencies/cairo-vm || exit
make deps-macos
cd - || exit
echo "Cairo VM installed"
# Install Stone Prover
git clone https://github.com/baking-bad/stone-prover ./dependencies/stone-prover
cd dependencies/stone-prover || exit
./install_deps.sh
bazelisk build //...
bazelisk test //...
cp ./build/bazelbin/src/starkware/main/cpu/cpu_air_prover .
cp ./build/bazelbin/src/starkware/main/cpu/cpu_air_verifier .
cd - || exit
echo "Stone Prover installed"
}
case "$OSTYPE" in
linux*) install_linux ;;
darwin*) install_macos ;;
msys*|cygwin*) unsupported_os "Windows" ;;
solaris*) unsupported_os "Solaris" ;;
bsd*) unsupported_os "BSD" ;;
*) unsupported_os "unknown: ${OSTYPE}" ;;
esac