forked from MinaProtocol/mina
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsetup-opam.sh
More file actions
executable file
·74 lines (60 loc) · 1.77 KB
/
Copy pathsetup-opam.sh
File metadata and controls
executable file
·74 lines (60 loc) · 1.77 KB
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
#!/bin/bash
set -x # echo on
set -eu
# Keep compile dirs to avoid recompiles
export OPAMKEEPBUILDDIR='true'
export OPAMREUSEBUILDDIR='true'
export OPAMYES=1
# Set term to xterm if not set
export TERM=${TERM:-xterm}
SWITCH='ocaml-variants.4.07.1+logoom'
if [[ -d ~/.opam ]]; then
# ocaml environment
eval $(opam config env)
# check for cache'd opam
SWITCH_LIST=$(opam switch list -s)
# Check to see if we have explicit switch version
SWITCH_FOUND=false
for val in $SWITCH_LIST; do
if [ $val == $SWITCH ]; then
SWITCH_FOUND=true
fi
done
else
# if there is no opam switch initialized, start from scratch
SWITCH_FOUND=false
fi
pushd /home/opam/opam-repository && git pull && popd
if [ "$SWITCH_FOUND" = true ]; then
# Add the o1-labs opam repository
opam repository add --yes --all --set-default o1-labs https://github.com/o1-labs/opam-repository.git
opam switch set $SWITCH
else
# Build opam from scratch
opam init
# Add the o1-labs opam repository
opam repository add --yes --all --set-default o1-labs https://github.com/o1-labs/opam-repository.git
opam update
opam switch create $SWITCH || true
opam switch $SWITCH
fi
# All our ocaml packages
opam update
opam switch import src/opam.export
eval $(opam config env)
# Extlib gets automatically installed, but we want our pin, so we should
# uninstall here
opam uninstall extlib
# Our pins
opam pin add src/external/ocaml-sodium
opam pin add src/external/rpc_parallel
opam pin add src/external/ocaml-extlib
# workaround a permissions problem in rpc_parallel .git
sudo chmod -R u+rw ~/.opam
opam pin add src/external/async_kernel
opam pin add src/external/coda_base58
opam pin add src/external/graphql_ppx
eval $(opam config env)
# show switch list at end
echo "opam switch list"
opam switch list -s