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
|
2016-12-02 16:20:02 +01:00
|
|
|
PACKAGES="core cryptokit.1.10 ocamlfind sexplib ZMQ"
|
2016-03-29 16:00:02 +02:00
|
|
|
#ppx_sexp_conv
|
2015-06-05 22:33:19 +02:00
|
|
|
|
2015-12-08 11:31:02 +01:00
|
|
|
# Needed for ZeroMQ
|
2016-12-02 12:47:25 +01:00
|
|
|
export C_INCLUDE_PATH="${QP_ROOT}"/include:"${C_INCLUDE_PATH}"
|
2015-12-08 11:31:02 +01:00
|
|
|
export LIBRARY_PATH="${QP_ROOT}"/lib:"${LIBRARY_PATH}"
|
|
|
|
export LD_LIBRARY_PATH="${QP_ROOT}"/lib:"${LD_LIBRARY_PATH}"
|
|
|
|
|
2015-09-30 13:19:45 +02:00
|
|
|
# return 0 if program version is equal or greater than check version
|
2016-01-14 17:47:18 +01:00
|
|
|
check_version () {
|
|
|
|
if [[ $1 == $2 ]]
|
|
|
|
then
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
local IFS=.
|
|
|
|
local i ver1=($1) ver2=($2)
|
|
|
|
# fill empty fields in ver1 with zeros
|
|
|
|
for ((i=${#ver1[@]}; i<${#ver2[@]}; i++))
|
|
|
|
do
|
|
|
|
ver1[i]=0
|
|
|
|
done
|
|
|
|
for ((i=0; i<${#ver1[@]}; i++))
|
|
|
|
do
|
|
|
|
if [[ -z ${ver2[i]} ]]
|
|
|
|
then
|
|
|
|
# fill empty fields in ver2 with zeros
|
|
|
|
ver2[i]=0
|
|
|
|
fi
|
|
|
|
if ((10#${ver1[i]} > 10#${ver2[i]}))
|
|
|
|
then
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
if ((10#${ver1[i]} < 10#${ver2[i]}))
|
|
|
|
then
|
|
|
|
return 2
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
return 0
|
2015-09-30 13:19:45 +02:00
|
|
|
}
|
|
|
|
|
2016-01-14 17:47:18 +01:00
|
|
|
|
2015-09-30 13:19:45 +02:00
|
|
|
i=$(gcc -dumpversion)
|
|
|
|
|
2016-01-14 17:59:56 +01:00
|
|
|
check_version 4.6 $i
|
|
|
|
if [[ $? == 1 ]]
|
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
|
|
|
|
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
|
|
|
|
|
2017-08-18 13:46:40 +02:00
|
|
|
echo N | ./ocaml.sh ${QP_ROOT}/bin/ 4.02.3 || 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
|
|
|
|
|
2016-01-26 15:05:46 +01:00
|
|
|
rm -f ../_build/ocaml.log
|
|
|
|
|