10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-11-03 20:54:00 +01:00
quantum_package/install/scripts/install_ocaml.sh

59 lines
1.3 KiB
Bash
Raw Normal View History

2015-06-08 18:13:51 +02:00
#!/bin/bash
2015-06-05 22:33:19 +02:00
2015-06-08 19:00:14 +02:00
cd ..
QP_ROOT=$PWD
cd -
# Normal installation
2015-12-07 22:26:42 +01:00
PACKAGES="core cryptokit ocamlfind sexplib ZMQ"
2015-06-05 22:33:19 +02:00
2015-12-08 11:31:02 +01:00
# Needed for ZeroMQ
export C_INCLUDE_PATH="${QP_ROOT}"/lib:"${C_INCLUDE_PATH}"
export LIBRARY_PATH="${QP_ROOT}"/lib:"${LIBRARY_PATH}"
export LD_LIBRARY_PATH="${QP_ROOT}"/lib:"${LD_LIBRARY_PATH}"
2015-06-05 22:33:19 +02:00
declare -i i
2015-12-08 11:31:02 +01:00
i=$(gcc -dumpversion | cut -d '.' -f 1)
if [[ i -lt 4 ]]
2015-06-05 22:33:19 +02:00
then
echo "GCC version $(gcc -dumpversion) too old. GCC >= 4.6 required."
exit 1
fi
2015-12-08 11:31:02 +01:00
if [[ i -eq 4 ]]
then
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
fi
2015-06-08 19:00:14 +02:00
if [[ -d ${HOME}/.opam ]]
then
source ${HOME}/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true
fi
2015-06-05 22:33:19 +02:00
cd Downloads || exit 1
chmod +x ocaml.sh || exit 1
2015-06-08 14:49:10 +02:00
echo N | ./ocaml.sh ${QP_ROOT}/bin/ || exit 1
2015-06-08 17:23:59 +02:00
2015-06-08 18:13:51 +02:00
${QP_ROOT}/bin/opam config setup -a -q || 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-08 17:23:59 +02:00
source ${HOME}/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true
2015-06-05 22:33:19 +02:00
2015-06-17 10:49:43 +02:00
NCPUs=$(cat /proc/cpuinfo | grep -i MHz | wc -l)
${QP_ROOT}/bin/opam install -j ${NCPUs} ${PACKAGES} -y -q || exit 1
2015-06-08 15:41:02 +02:00
rm -f ../_build/ocaml.log
2015-06-08 17:23:59 +02:00
exit 0