2014-10-23 22:40:21 +02:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# Downloads and installs ocaml, opam and core library
|
|
|
|
# Thu Oct 23 21:58:40 CEST 2014
|
|
|
|
|
2014-10-26 17:29:11 +01:00
|
|
|
PACKAGES="core cryptokit"
|
2014-10-23 22:40:21 +02:00
|
|
|
|
2015-01-19 16:11:36 +01:00
|
|
|
# Check the QPACKAGE_ROOT directory
|
|
|
|
if [[ -z ${QPACKAGE_ROOT} ]]
|
|
|
|
then
|
|
|
|
echo "The QPACKAGE_ROOT environment variable is not set."
|
|
|
|
echo "Please reload the quantum_package.rc file."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd ${QPACKAGE_ROOT}
|
|
|
|
|
|
|
|
|
2015-01-08 20:35:29 +01:00
|
|
|
function asksure() {
|
|
|
|
echo -n "Are you sure (Y/N)? "
|
|
|
|
return $retval
|
|
|
|
}
|
|
|
|
|
2014-10-29 22:25:30 +01:00
|
|
|
if [[ -f quantum_package.rc ]]
|
|
|
|
then
|
|
|
|
source quantum_package.rc
|
|
|
|
fi
|
2014-10-23 22:40:21 +02:00
|
|
|
make -C ocaml Qptypes.ml &> /dev/null
|
|
|
|
if [[ $? -ne 0 ]]
|
|
|
|
then
|
|
|
|
|
2015-01-12 19:24:05 +01:00
|
|
|
if [[ -d ${OCAMLBREW_BASE} ]]
|
2015-01-08 20:35:29 +01:00
|
|
|
then
|
2015-01-12 19:24:05 +01:00
|
|
|
echo "Remove directory ${OCAMLBREW_BASE} ? [Y/n]"
|
2015-01-08 20:35:29 +01:00
|
|
|
while read -r -n 1 -s answer; do
|
|
|
|
if [[ $answer = [YyNn] ]]; then
|
|
|
|
[[ $answer = [Yy] ]] && rm -rf -- ${HOME}/ocamlbrew
|
|
|
|
[[ $answer = [Nn] ]] && exit 1
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
2015-01-12 19:24:05 +01:00
|
|
|
echo $answer
|
2015-01-08 20:35:29 +01:00
|
|
|
fi
|
2014-10-23 23:29:17 +02:00
|
|
|
scripts/fetch_from_web.py "https://raw.github.com/hcarty/ocamlbrew/master/ocamlbrew-install" ocamlbrew-install.sh
|
|
|
|
cat < ocamlbrew-install.sh | env OCAMLBREW_FLAGS="-r" bash | tee ocamlbrew_install.log
|
2015-01-19 11:30:52 +01:00
|
|
|
grep "source " ocamlbrew_install.log | grep "etc/ocamlbrew.bashrc" >> quantum_package.rc
|
2014-10-23 22:40:21 +02:00
|
|
|
source quantum_package.rc
|
2014-10-26 17:29:11 +01:00
|
|
|
echo Y | opam install ${PACKAGES}
|
2014-10-23 22:40:21 +02:00
|
|
|
fi
|
|
|
|
make -C ocaml Qptypes.ml
|
|
|
|
|
|
|
|
|