10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-11-07 06:33:53 +01:00
quantum_package/setup_environment.sh

82 lines
1.9 KiB
Bash
Executable File
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
#
# Setup script. Downloads dependencies if they are not already present
# in the current installation.
# Thu Oct 23 22:02:08 CEST 2014
BLUE=""
RED=""
BLACK="(B"
QPACKAGE_ROOT="$( cd "$(dirname "$BASH_SOURCE")" ; pwd -P )"
if [[ -z "${IRPF90}" ]] ;
then
make irpf90
IRPF90="${QPACKAGE_ROOT}"/bin/irpf90
if [[ ! -x "${IRPF90}" ]]
then
echo $RED "Error in IRPF90 installation" $BLACK
exit 1
fi
fi
if [[ -z ${OCAMLBREW_BASE} ]]
then
export OCAMLBREW_BASE="$HOME/ocamlbrew"
fi
cat << EOF > quantum_package.rc
export IRPF90="${IRPF90}"
export OCAMLBREW_BASE="${OCAMLBREW_BASE}"
export QPACKAGE_ROOT=\$( cd \$(dirname "\${BASH_SOURCE}") ; pwd -P )
export LD_LIBRARY_PATH="\${QPACKAGE_ROOT}"/lib:\${LD_LIBRARY_PATH}
export LIBRARY_PATH="\${QPACKAGE_ROOT}"/lib:\${LIBRARY_PATH}
export C_INCLUDE_PATH="\${QPACKAGE_ROOT}"/include:\${C_INCLUDE_PATH}
export PYTHONPATH=\${PYTHONPATH}:"\${QPACKAGE_ROOT}"/scripts
export PATH=\${PATH}:"\${QPACKAGE_ROOT}"/scripts
export PATH=\${PATH}:"\${QPACKAGE_ROOT}"/bin
export PATH=\${PATH}:"\${QPACKAGE_ROOT}"/ocaml
source "\${QPACKAGE_ROOT}"/bin/irpman &> /dev/null
source "\${OCAMLBREW_BASE}"/ocaml-4*/etc/ocamlbrew.bashrc &> /dev/null
EOF
source quantum_package.rc
make EZFIO
if [[ ! -d ${QPACKAGE_ROOT}/EZFIO ]]
then
echo $RED "Error in EZFIO installation" $BLACK
exit 1
fi
make ocaml
if [[ ! -f ${QPACKAGE_ROOT}/ocaml/Qptypes.ml ]]
then
echo $RED "Error in ocaml installation" $BLACK
exit 1
fi
make resultsFile
if [[ ! -d ${QPACKAGE_ROOT}/resultsFile ]]
then
echo $RED "Error in resultsFile installation" $BLACK
exit 1
fi
echo $RED "
=======================================================
To complete the installation, add the following line to
your ~/.bashrc:
source ${QPACKAGE_ROOT}/quantum_package.rc
=======================================================
" $BLACK
source quantum_package.rc
exec bash