10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-11-09 07:33:53 +01:00
quantum_package/scripts/install/install_ocaml.sh

68 lines
1.5 KiB
Bash
Raw Normal View History

#!/bin/bash
#
# Downloads and installs ocaml, opam and core library
# Thu Oct 23 21:58:40 CEST 2014
PACKAGES="core cryptokit"
2015-03-24 16:12:51 +01:00
OPAM_BASE=$HOME/.opam
# 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
make -C ocaml Qptypes.ml &> /dev/null
2015-03-24 16:12:51 +01: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
fi
2015-05-13 15:42:53 +02:00
${QPACKAGE_ROOT}/scripts/install/fetch_from_web.py \
"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
if [[ ! -f ${QPACKAGE_ROOT}/bin/opam ]]
then
2015-03-24 16:12:51 +01:00
echo "Installation of OPAM failed"
exit 2
fi
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}
make -C ocaml Qptypes.ml
2015-03-24 16:12:51 +01:00
exit 0