10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-11-19 04:22:36 +01:00
quantum_package/install/scripts/install_ocaml.sh

41 lines
825 B
Bash
Raw Normal View History

2015-06-05 22:33:19 +02:00
#!/bin/bash -x
PACKAGES="core cryptokit ocamlfind sexplib"
declare -i i
i=$(gcc -dumpversion | cut -d '.' -f 2)
if [[ i -lt 6 ]]
then
echo "GCC version $(gcc -dumpversion) too old. GCC >= 4.6 required."
exit 1
fi
cd ..
2015-06-08 14:49:10 +02:00
QP_ROOT=$PWD
2015-06-05 22:33:19 +02:00
cd -
cd Downloads || exit 1
chmod +x ocaml.sh || exit 1
if [[ -d ${HOME}/.opam ]]
then
source ${HOME}/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true
fi
2015-06-08 14:49:10 +02:00
echo N | ./ocaml.sh ${QP_ROOT}/bin/ || exit 1
if [[ ! -f ${QP_ROOT}/bin/opam ]]
2015-06-05 22:33:19 +02:00
then
echo "Installation of OPAM failed"
exit 2
fi
2015-06-08 15:38:37 +02:00
${QP_ROOT}/bin/opam config setup -a || exit 1
2015-06-05 22:33:19 +02:00
2015-06-08 14:49:10 +02:00
export LD_LIBRARY_PATH=${QP_ROOT}/lib:${LD_LIBRARY_PATH}
export LIBRARY_PATH=${QP_ROOT}/lib:${LIBRARY_PATH}
export C_INCLUDE_PATH=${QP_ROOT}/lib:${C_INCLUDE_PATH}
2015-06-05 22:33:19 +02:00
opam install ${PACKAGES} || exit 1
rm -f ../_build/ocaml.log
exit 0