From 81b9c05e77a8c27fbd5e6982d1f056659688d512 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 18 Dec 2015 22:53:27 +0100 Subject: [PATCH] Improved install scripts --- configure.sh | 17 ++++++++++++----- install/scripts/install_ezfio.sh | 4 +--- install/scripts/install_f77_zmq.sh | 9 +++++---- install/scripts/install_irpf90.sh | 15 ++++++++------- install/scripts/install_ninja.sh | 3 ++- install/scripts/install_ocaml.sh | 5 +++-- install/scripts/install_ocaml_zmq.sh | 21 ++++++++++++++++++--- install/scripts/install_qmcchemrc.sh | 2 +- install/scripts/install_zmq.sh | 15 ++++++++------- 9 files changed, 58 insertions(+), 33 deletions(-) diff --git a/configure.sh b/configure.sh index c050d38..e37b138 100755 --- a/configure.sh +++ b/configure.sh @@ -2,16 +2,23 @@ set -e set -u -cd install +QMCCHEM_PATH=$PWD +mkdir -p "${QMCCHEM_PATH}"/bin +cd "${QMCCHEM_PATH}"/install mkdir -p Downloads _build -mkdir -p bin -if [[ ! -x ../bin/ninja ]] +# TODO : Check if network is up (ping) +if [[ ! -x "${QMCCHEM_PATH}"/bin/ninja ]] then echo "Installing Ninja" ./scripts/install_ninja.sh &> _build/ninja.log + if [[ ! -x "${QMCCHEM_PATH}"/bin/ninja ]] + then + echo "Installation of Ninja failed" + exit 1 + fi touch _build/ninja.ok fi -touch ../{src,ocaml}/ls_md5 -exec ../bin/ninja "$@" +touch "${QMCCHEM_PATH}"/{src,ocaml}/ls_md5 +exec "${QMCCHEM_PATH}"/bin/ninja "$@" diff --git a/install/scripts/install_ezfio.sh b/install/scripts/install_ezfio.sh index 3b3899e..8031ac8 100755 --- a/install/scripts/install_ezfio.sh +++ b/install/scripts/install_ezfio.sh @@ -4,11 +4,9 @@ TARGET=ezfio function _install() { + cd .. ; QMCCHEM_PATH="$PWD" ; cd - set -e set -u - cd .. - QMCCHEM_PATH="$PWD" - cd - rm -rf "${QMCCHEM_PATH}"/EZFIO cd "${BUILD}"/config rm -f -- qmc.config properties.config diff --git a/install/scripts/install_f77_zmq.sh b/install/scripts/install_f77_zmq.sh index ecde0df..a996788 100755 --- a/install/scripts/install_f77_zmq.sh +++ b/install/scripts/install_f77_zmq.sh @@ -3,16 +3,17 @@ TARGET=f77_zmq function _install() { + cd .. ; QMCCHEM_PATH="$PWD" ; cd - set +u - export C_INCLUDE_PATH=$C_INCLUDE_PATH:../../../lib + export C_INCLUDE_PATH="${C_INCLUDE_PATH}":../../../lib set -e set -u cd "${BUILD}" - export ZMQ_H=../../../lib/zmq.h + export ZMQ_H="${QMCCHEM_PATH}"/lib/zmq.h cp "${ZMQ_H}" . - make -j + make -j 8 cd - - rm -f -- "../src/ZMQ/f77_zmq.h" "../lib/libf77zmq.a" "../lib/libf77zmq.so" + rm -f -- "${QMCCHEM_PATH}"/src/ZMQ/f77_zmq.h "${QMCCHEM_PATH}"/lib/libf77zmq.a "${QMCCHEM_PATH}"/lib/libf77zmq.so cp "${BUILD}"/libf77zmq.{a,so} ../lib/ cp "${BUILD}"/f77_zmq.h ../src/ZMQ/ return 0 diff --git a/install/scripts/install_irpf90.sh b/install/scripts/install_irpf90.sh index a881336..3c193ea 100755 --- a/install/scripts/install_irpf90.sh +++ b/install/scripts/install_irpf90.sh @@ -3,22 +3,23 @@ TARGET=irpf90 function _install() { + cd .. ; QMCCHEM_PATH="$PWD" ; cd - set -e set -u - make -C "${BUILD}" -j - rm -rf -- ../irpf90 - mv "${BUILD}" ../ + make -C "${BUILD}" -j 8 + rm -rf -- "${QMCCHEM_PATH}"/irpf90 + mv "${BUILD}" "${QMCCHEM_PATH}" # Check the build is OK - [[ -x ../irpf90/bin/irpf90 ]] - [[ -x ../irpf90/bin/irpman ]] + [[ -x "${QMCCHEM_PATH}"/irpf90/bin/irpf90 ]] + [[ -x "${QMCCHEM_PATH}"/irpf90/bin/irpman ]] for i in irpf90 irpman do - rm -rf -- ../bin/$i + rm -rf -- "${QMCCHEM_PATH}"/bin/$i cat << EOF > ../bin/$i #!/bin/bash -u exec "\${QMCCHEM_PATH}"/irpf90/bin/$i "\$@" EOF - chmod +x ../bin/$i + chmod +x "${QMCCHEM_PATH}"/bin/$i done return 0 } diff --git a/install/scripts/install_ninja.sh b/install/scripts/install_ninja.sh index 6b71b5c..882437e 100755 --- a/install/scripts/install_ninja.sh +++ b/install/scripts/install_ninja.sh @@ -8,12 +8,13 @@ URL="http://github.com/martine/ninja/archive/v1.5.3.tar.gz" function _install() { + cd .. ; QMCCHEM_PATH="$PWD" ; cd - set -e set -u cd "${BUILD}" ./configure.py --bootstrap cd - - mv "${BUILD}/ninja" ../bin/ + mv "${BUILD}/ninja" "${QMCCHEM_PATH}"/bin/ return 0 } diff --git a/install/scripts/install_ocaml.sh b/install/scripts/install_ocaml.sh index eb1f5aa..8a4ce0d 100755 --- a/install/scripts/install_ocaml.sh +++ b/install/scripts/install_ocaml.sh @@ -3,6 +3,7 @@ set -u set -e +cd .. ; QMCCHEM_PATH="$PWD" ; cd - PACKAGES="core cryptokit ocamlfind sexplib" declare -i i @@ -13,7 +14,7 @@ then exit 1 fi -source ../qmcchemrc +source "${QMCCHEM_PATH}"/qmcchemrc cd Downloads chmod +x opam_installer.sh @@ -41,7 +42,7 @@ export LIBRARY_PATH="${QMCCHEM_PATH}/lib:${LIBRARY_PATH}" export C_INCLUDE_PATH="${QMCCHEM_PATH}/lib:${C_INCLUDE_PATH}" set -u opam install ${PACKAGES} -rm ../_build/ocaml.log +rm "${QMCCHEM_PATH}"/install/_build/ocaml.log exit 0 diff --git a/install/scripts/install_ocaml_zmq.sh b/install/scripts/install_ocaml_zmq.sh index 925edd0..76e7742 100755 --- a/install/scripts/install_ocaml_zmq.sh +++ b/install/scripts/install_ocaml_zmq.sh @@ -1,18 +1,33 @@ #!/bin/bash -x +cd .. ; QMCCHEM_PATH="$PWD" ; cd - set -e set -u + +# Check GCC version declare -i i -i=$(gcc -dumpversion | cut -d '.' -f 2) -if [[ i -lt 6 ]] +i=$(gcc -dumpversion | cut -d '.' -f 1) +if [[ i -lt 4 ]] then echo "GCC version $(gcc -dumpversion) too old. GCC >= 4.6 required." exit 1 fi +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 +# End check GCC version + + set +u -source ../qmcchemrc +source "${QMCCHEM_PATH}"/qmcchemrc set -u opam install zmq rm -f _build/ocaml_zmq.log diff --git a/install/scripts/install_qmcchemrc.sh b/install/scripts/install_qmcchemrc.sh index 476abe1..e00cd42 100755 --- a/install/scripts/install_qmcchemrc.sh +++ b/install/scripts/install_qmcchemrc.sh @@ -11,7 +11,7 @@ export QMCCHEM_MPIRUN="mpirun" export QMCCHEM_MPIRUN_FLAGS="--bind-to-core" #export QMCCHEM_NIC=ib0 source \${QMCCHEM_PATH}/irpf90/bin/irpman -source \${QMCCHEM_PATH}/EZFIO/Bash/ezfio.sh +#source \${QMCCHEM_PATH}/EZFIO/Bash/ezfio.sh EOF cd - diff --git a/install/scripts/install_zmq.sh b/install/scripts/install_zmq.sh index 58a160c..80da3a3 100755 --- a/install/scripts/install_zmq.sh +++ b/install/scripts/install_zmq.sh @@ -4,6 +4,7 @@ TARGET=zmq function _install() { LIBVERSION=4 + cd .. ; QMCCHEM_PATH="$PWD" ; cd - set +u export C_INCLUDE_PATH="${C_INCLUDE_PATH}":./ set -e @@ -12,13 +13,13 @@ function _install() ./configure --without-libsodium make -j 8 cd - - rm -f -- ../lib/libzmq.a ../lib/libzmq.so ../lib/libzmq.so.$LIBVERSION -# cp "${BUILD}"/.libs/libzmq.a ../lib/ -# cp "${BUILD}"/.libs/libzmq.so ../lib/libzmq.so.$LIBVERSION - cp "${BUILD}"/src/.libs/libzmq.a ../lib/ - cp "${BUILD}"/src/.libs/libzmq.so ../lib/libzmq.so.$LIBVERSION - cp "${BUILD}"/include/{zmq,zmq_utils}.h ../lib/ - cd ../lib + rm -f -- "${QMCCHEM_PATH}"/lib/libzmq.{a,so,so.$LIBVERSION} +# cp "${BUILD}"/.libs/libzmq.a "${QMCCHEM_PATH}"/lib/ +# cp "${BUILD}"/.libs/libzmq.so "${QMCCHEM_PATH}"/lib/libzmq.so.$LIBVERSION + cp "${BUILD}"/src/.libs/libzmq.a "${QMCCHEM_PATH}"/lib/ + cp "${BUILD}"/src/.libs/libzmq.so "${QMCCHEM_PATH}"/lib/libzmq.so.$LIBVERSION + cp "${BUILD}"/include/{zmq,zmq_utils}.h "${QMCCHEM_PATH}"/lib/ + cd "${QMCCHEM_PATH}"/lib ln libzmq.so.$LIBVERSION libzmq.so || cp libzmq.so.$LIBVERSION libzmq.so cd - return 0