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"
|
2015-03-24 16:12:51 +01:00
|
|
|
OPAM_BASE=$HOME/.opam
|
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}
|
|
|
|
|
|
|
|
|
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
|
2015-03-24 16:12:51 +01:00
|
|
|
|
2014-10-23 22:40:21 +02:00
|
|
|
if [[ $? -ne 0 ]]
|
|
|
|
then
|
|
|
|
|
2015-03-24 16:12:51 +01:00
|
|
|
if [[ -d ${OPAM_BASE} ]]
|
2015-01-08 20:35:29 +01:00
|
|
|
then
|
2015-03-24 16:12:51 +01:00
|
|
|
echo "${OPAM_BASE} exists."
|
|
|
|
echo "Re-install ? [y/N]"
|
2015-01-08 20:35:29 +01:00
|
|
|
while read -r -n 1 -s answer; do
|
|
|
|
if [[ $answer = [YyNn] ]]; then
|
2015-03-24 16:12:51 +01:00
|
|
|
if [[ $answer = [Yy] ]] ; then
|
|
|
|
echo " - Remove your directory ${OPAM_BASE}"
|
|
|
|
echo " - Restart setup"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if [[ $answer = [Nn] ]] ; then
|
|
|
|
make -C ocaml Qptypes.ml
|
|
|
|
exit 0
|
|
|
|
fi
|
2015-01-08 20:35:29 +01:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
2014-10-23 22:40:21 +02:00
|
|
|
fi
|
2015-05-13 15:42:53 +02:00
|
|
|
${QPACKAGE_ROOT}/scripts/install/fetch_from_web.py \
|
2015-03-25 23:03:51 +01:00
|
|
|
"https://raw.github.com/ocaml/opam/master/shell/opam_installer.sh" opam_installer.sh
|
2015-03-24 16:12:51 +01:00
|
|
|
chmod +x opam_installer.sh
|
|
|
|
echo N | ./opam_installer.sh ${QPACKAGE_ROOT}/bin
|
|
|
|
|
2015-03-25 16:27:16 +01:00
|
|
|
if [[ ! -f ${QPACKAGE_ROOT}/bin/opam ]]
|
|
|
|
then
|
2015-03-24 16:12:51 +01:00
|
|
|
echo "Installation of OPAM failed"
|
|
|
|
exit 2
|
|
|
|
fi
|
2015-03-26 01:02:12 +01:00
|
|
|
rm -f opam_installer.sh
|
2015-03-24 16:12:51 +01:00
|
|
|
${QPACKAGE_ROOT}/bin/opam config setup -a --dot-profile ${QPACKAGE_ROOT}/quantum_package.rc
|
|
|
|
|
|
|
|
source ${QPACKAGE_ROOT}/quantum_package.rc
|
|
|
|
echo Y | opam install ${PACKAGES}
|
|
|
|
|
2014-10-23 22:40:21 +02:00
|
|
|
make -C ocaml Qptypes.ml
|
|
|
|
|
2015-03-24 16:12:51 +01:00
|
|
|
exit 0
|
2014-10-23 22:40:21 +02:00
|
|
|
|