-
Notifications
You must be signed in to change notification settings - Fork 89
Expand file tree
/
Copy pathmake.sh
More file actions
executable file
·161 lines (153 loc) · 5.71 KB
/
Copy pathmake.sh
File metadata and controls
executable file
·161 lines (153 loc) · 5.71 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
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#!/usr/bin/env bash
set -e # exit immediately if a command fails
set -o pipefail # or all $? in pipe instead of returning exit code of the last command only
TARGET=src/goblint
opam_setup() {
set -x
opam init -y -a --bare $SANDBOXING # sandboxing is disabled in travis and docker
opam update
# This is what we used to do and what we'd like to do:
# opam switch -y create . --deps-only --packages=ocaml-variants.4.14.2+options,ocaml-option-flambda --locked
# But this fails on opam < 2.2 due to a bug (https://github.com/ocaml/opam/issues/6946).
# So this is the workaround from @kit-ty-kate (while we still want to support opam < 2.2):
opam switch -y create . --no-install --packages=ocaml-variants.4.14.2+options,ocaml-option-flambda
opam install -y ./*.opam.locked --deps-only
}
rule() {
case $1 in
# new rules using dune
clean)
eval $(opam env)
git clean -X -f
dune clean
;; nat*)
eval $(opam config env)
dune build $TARGET.exe &&
rm -f goblint &&
cp _build/default/$TARGET.exe goblint
;; coverage)
eval $(opam config env)
dune build --instrument-with bisect_ppx $TARGET.exe &&
rm -f goblint &&
cp _build/default/$TARGET.exe goblint
;; release)
eval $(opam config env)
dune build --profile=release $TARGET.exe &&
rm -f goblint &&
cp _build/default/$TARGET.exe goblint
;; view)
eval $(opam config env)
dune build gobview
;; watch)
eval $(opam config env)
# dune build -w $TARGET.exe
dune runtest --no-buffer --watch
;; privPrecCompare)
eval $(opam config env)
dune build src/privPrecCompare.exe &&
rm -f privPrecCompare &&
cp _build/default/src/privPrecCompare.exe privPrecCompare
;; apronPrecCompare)
eval $(opam config env)
dune build src/apronPrecCompare.exe &&
rm -f apronPrecCompare &&
cp _build/default/src/apronPrecCompare.exe apronPrecCompare
;; messagesCompare)
eval $(opam config env)
dune build src/messagesCompare.exe &&
rm -f messagesCompare &&
cp _build/default/src/messagesCompare.exe messagesCompare
;; byte)
eval $(opam config env)
dune build goblint.byte &&
rm -f goblint.byte &&
cp _build/default/goblint.byte goblint.byte
# setup, dependencies
;; deps)
eval $(opam config env)
{
opam install -y . --deps-only --locked --update-invariant &&
opam upgrade -y $(opam list --pinned -s)
} || {
opam update
opam pin remove -y $(opam list --pinned -s) || echo "No pins! All good...\n"
opam install -y . --deps-only --locked --update-invariant
opam upgrade -y $(opam list --pinned -s)
}
;; setup)
echo "Make sure you have the following installed: opam >= 2.2.0, git, patch, m4, autoconf, libgmp-dev, libmpfr-dev, pkg-config"
echo "For the --html output you also need: graphviz and python3-pygments (optional)"
echo "For running the regression tests you also need: ruby, gem, curl, and the os gem"
echo "For reference see ./Dockerfile or ./scripts/travis-ci.sh"
opam_setup
;; dev)
eval $(opam env)
echo "Installing opam packages for test, doc and dev-setup..."
opam install -y . --deps-only --locked --with-test --with-doc --with-dev-setup
echo "Installing Pre-commit hook..."
cd .git/hooks; ln -sf ../../scripts/hooks/pre-commit; cd -
# Use `git commit -n` to temporarily bypass the hook if necessary.
echo "Installing gem parallel (not needed for ./scripts/update_suite.rb -s)"
sudo gem install parallel
sudo gem install os
;; headers)
curl -L -O https://github.com/goblint/linux-headers/archive/master.tar.gz
tar xf master.tar.gz && rm master.tar.gz
rm -rf linux-headers && mv linux-headers-master linux-headers
for n in $(compgen -c gcc- | sed 's/gcc-//'); do if [ $n != 5 ]; then cp -n linux-headers/include/linux/compiler-gcc{5,$n}.h; fi; done
;; npm)
if test ! -e "webapp/package.json"; then
git submodule update --init --recursive webapp
fi
cd webapp && npm install && npm start
;; jar)
echo "Make sure you have the following installed: javac, ant, dot (from graphviz)"
if test ! -e "g2html/build.xml"; then
git submodule update --init --recursive g2html
fi
cd g2html && ant jar && cd .. &&
cp g2html/g2html.jar .
;; setup_gobview )
[[ -f gobview/gobview.opam ]] || git submodule update --init gobview
opam install --deps-only --locked gobview/
;; install)
eval $(opam config env)
dune build @install
dune install
;; uninstall)
eval $(opam config env)
dune uninstall
;; relocatable)
PREFIX=relocatable
# requires chrpath
eval $(opam env)
dune build @install
dune install --relocatable --prefix $PREFIX
# must replace absolute apron runpath to C library with relative
chrpath -r '$ORIGIN/../share/apron/lib' $PREFIX/bin/goblint
# remove goblint.lib ocaml library
rm -r $PREFIX/lib
# copy just necessary apron C libraries
mkdir -p $PREFIX/share/apron/lib/
cp _opam/share/apron/lib/libapron.so $PREFIX/share/apron/lib/
cp _opam/share/apron/lib/liboctD.so $PREFIX/share/apron/lib/
cp _opam/share/apron/lib/libboxD.so $PREFIX/share/apron/lib/
cp _opam/share/apron/lib/libpolkaMPQ.so $PREFIX/share/apron/lib/
# tests
;; test)
eval $(opam env)
dune runtest
;; sanitytest)
./scripts/update_suite.rb
;; *)
echo "Unknown action '$1'. Try clean, native, byte, profile or doc.";;
esac;
}
if [ $# -eq 0 ]; then
rule native
else
while [ $# -gt 0 ]; do
rule $1;
shift
done
fi