forked from opprop/units-inference
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup-coq.sh
executable file
·58 lines (46 loc) · 1.24 KB
/
setup-coq.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
#!/bin/bash
# Fail the whole script if any command fails
set -e
myDir="`dirname $0`"
case `uname -s` in
CYGWIN*)
myDir=`cygpath -m $mydir`
;;
esac
if [ "$myDir" = "" ];
then
myDir="."
fi
ROOT=$(cd ${myDir} && pwd)
# install dependencies
echo "Installing ocaml and camlp5 packages via sudo apt-get, enter password if prompted"
sudo apt-get install ocaml camlp5
COQ_TAR_FILE=V8.8.2.tar.gz
# download coq sources
if [ -e $ROOT/$COQ_TAR_FILE ] ; then
echo "Found existing $COQ_TAR_FILE in $ROOT, skip downloading sources."
else
echo "Downloading $COQ_TAR_FILE from github ..."
wget "https://github.com/coq/coq/archive/${COQ_TAR_FILE}"
echo "Downloaded $COQ_TAR_FILE from github"
fi
# extract coq sources into $ROOT/coq-source
if [ ! -d $ROOT/coq-source ] ; then
mkdir $ROOT/coq-source
fi
if [ ! -e $ROOT/coq-source/Makefile ] ; then
echo "Extracting sources to $ROOT/coq-source"
tar -xzf $COQ_TAR_FILE
mv $ROOT/coq-*/* $ROOT/coq-source
fi
# install coq locally
cd $ROOT/coq-source
if [ ! -e $ROOT/coq-source/bin/coqc ] ; then
echo "Configuring coq for local installation"
./configure -local
echo "Compiling coq"
make
fi
# test coqc
echo "Coq installed at $ROOT/coq-source/bin/coqc"
./bin/coqc -v