10
0
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-11-19 04:22:32 +01:00

updated configure

This commit is contained in:
Kevin Gasperich 2022-06-22 18:14:20 -05:00
parent 2ba43e6b6c
commit 30962a0c57

275
configure vendored
View File

@ -3,8 +3,6 @@
# Quantum Package configuration script # Quantum Package configuration script
# #
TEMP=$(getopt -o c:i:h -l config:,install:,help -n $0 -- "$@") || exit 1
eval set -- "$TEMP"
export QP_ROOT="$( cd "$(dirname "$0")" ; pwd -P )" export QP_ROOT="$( cd "$(dirname "$0")" ; pwd -P )"
echo "QP_ROOT="$QP_ROOT echo "QP_ROOT="$QP_ROOT
@ -14,24 +12,9 @@ unset CCXX
# Force GCC instead of ICC for dependencies # Force GCC instead of ICC for dependencies
export CC=gcc export CC=gcc
# Download submodules
# /!\ When updating version, update also etc files git submodule init
git submodule update
EZFIO_TGZ="EZFIO-v2.0.3.tar.gz"
BATS_URL="https://github.com/bats-core/bats-core/archive/v1.1.0.tar.gz"
BUBBLE_URL="https://github.com/projectatomic/bubblewrap/releases/download/v0.3.3/bubblewrap-0.3.3.tar.xz"
DOCOPT_URL="https://github.com/docopt/docopt/archive/0.6.2.tar.gz"
BSE_URL="https://github.com/MolSSI-BSE/basis_set_exchange/archive/v0.8.11.tar.gz"
F77ZMQ_URL="https://github.com/scemama/f77_zmq/archive/v4.2.5.tar.gz"
GMP_URL="ftp://ftp.gnu.org/gnu/gmp/gmp-6.1.2.tar.bz2"
IRPF90_URL="https://gitlab.com/scemama/irpf90/-/archive/v2.0.0/irpf90-v2.0.0.tar.gz"
LIBCAP_URL="https://git.kernel.org/pub/scm/linux/kernel/git/morgan/libcap.git/snapshot/libcap-2.25.tar.gz"
NINJA_URL="https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-linux.zip"
OCAML_URL="https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh"
RESULTS_URL="https://gitlab.com/scemama/resultsFile/-/archive/v2.0/resultsFile-v2.0.tar.gz"
ZEROMQ_URL="https://github.com/zeromq/libzmq/releases/download/v4.2.5/zeromq-4.2.5.tar.gz"
ZLIB_URL="https://www.zlib.net/zlib-1.2.11.tar.gz"
function help() function help()
{ {
@ -39,17 +22,17 @@ function help()
Quantum Package configuration script. Quantum Package configuration script.
Usage: Usage:
$(basename $0) -c <file> | --config=<file> $(basename $0) -c <file>
$(basename $0) -h | --help $(basename $0) -h
$(basename $0) -i <package> | --install=<package> $(basename $0) -i <package>
Options: Options:
-c, --config=<file> Define a COMPILATION configuration file, -c <file> Define a COMPILATION configuration file,
in "${QP_ROOT}/config/". in "${QP_ROOT}/config/".
-h, --help Print the HELP message -h Print the HELP message
-i, --install=<package> INSTALL <package>. Use at your OWN RISK: -i <package> INSTALL <package>. Use at your OWN RISK:
no support will be provided for the installation of no support will be provided for the installation of
dependencies. dependencies.
Example: Example:
./$(basename $0) -c config/gfortran.cfg ./$(basename $0) -c config/gfortran.cfg
@ -83,33 +66,30 @@ function execute () {
} }
PACKAGES="" PACKAGES=""
OCAML_PACKAGES="ocamlbuild cryptokit zmq sexplib ppx_sexp_conv ppx_deriving getopt"
while true ; do
case "$1" in while getopts "d:c:i:h" c ; do
-c|--config) case "$c" in
case "$2" in c)
case "$OPTARG" in
"") help ; break;; "") help ; break;;
*) if [[ -f $2 ]] ; then *) if [[ -f $OPTARG ]] ; then
CONFIG="$2" CONFIG="$OPTARG"
else else
error "error: configuration file $2 not found." error "error: configuration file $OPTARG not found."
exit 1 exit 1
fi fi
esac esac;;
shift 2;; i)
-i|--install) case "$OPTARG" in
case "$2" in
"") help ; break;; "") help ; break;;
*) PACKAGES="${PACKAGE} $2" *) PACKAGES="${PACKAGE} $OPTARG"
esac esac;;
shift 2;; h)
-h|-help|--help)
help help
exit 0;; exit 0;;
--) shift ; break ;;
*) *)
error $(basename $0)": unknown option $1, try --help" error $(basename $0)": unknown option $c, try -h for help"
exit 2;; exit 2;;
esac esac
done done
@ -126,23 +106,13 @@ source quantum_package.rc
function fail() { function fail() {
echo "You can try to install it using the -i option." echo "You can try to install it using the -i option."
echo "Please refer to INSTALL.rst to install the missing dependencies." echo "Please refer to INSTALL.rst to install the missing dependencies."
exit 1 exit -1
} }
function success() { function success() {
echo "" echo ""
echo "Configuration successful." echo "Configuration successful."
exit 1 exit 0
}
function download() {
echo "Downloading $1"
echo ""
printf "\e[0;34m"
wget --no-check-certificate $1 --output-document=$2 || error "Unable to download $1"
printf "\e[m"
echo "Saved dowloaded file as $2"
echo ""
} }
function not_found() { function not_found() {
@ -177,16 +147,15 @@ function find_dir() {
fi fi
} }
# Make program believe stdin is a tty
function faketty() {
script -qfc "$(printf "%q " "$@")" /dev/null
}
# Extract EZFIO if needed # Install IRPF90 if needed
EZFIO=$(find_dir "${QP_ROOT}"/external/ezfio) IRPF90=$(find_exe irpf90)
if [[ ${EZFIO} = $(not_found) ]] ; then if [[ ${IRPF90} = $(not_found) ]] ; then
execute << EOF make -C ${QP_ROOT}/external/irpf90
cd "\${QP_ROOT}"/external
tar --gunzip --extract --file ${EZFIO_TGZ}
rm -rf ezfio
mv EZFIO ezfio || mv EZFIO-v*/ ezfio
EOF
fi fi
@ -211,7 +180,7 @@ if [[ "${PACKAGES}.x" != ".x" ]] ; then
fi fi
if [[ ${PACKAGES} = all ]] ; then if [[ ${PACKAGES} = all ]] ; then
PACKAGES="zlib ninja irpf90 zeromq f77zmq gmp libcap bwrap ocaml ezfio docopt resultsFile bats" PACKAGES="zlib ninja zeromq f77zmq gmp ocaml docopt resultsFile bats"
fi fi
@ -219,159 +188,72 @@ for PACKAGE in ${PACKAGES} ; do
if [[ ${PACKAGE} = ninja ]] ; then if [[ ${PACKAGE} = ninja ]] ; then
download ${NINJA_URL} "${QP_ROOT}"/external/ninja.zip
execute << EOF execute << EOF
rm -f "\${QP_ROOT}"/bin/ninja rm -f "\${QP_ROOT}"/bin/ninja
unzip "\${QP_ROOT}"/external/ninja.zip -d "\${QP_ROOT}"/bin unzip "\${QP_ROOT}"/external/qp2-dependencies/ninja-linux.zip -d "\${QP_ROOT}"/bin
EOF EOF
elif [[ ${PACKAGE} = gmp ]] ; then elif [[ ${PACKAGE} = gmp ]] ; then
download ${GMP_URL} "${QP_ROOT}"/external/gmp.tar.bz2
execute << EOF execute << EOF
cd "\${QP_ROOT}"/external cd "\${QP_ROOT}"/external
tar --bzip2 --extract --file gmp.tar.bz2 tar --bzip2 --extract --file qp2-dependencies/gmp-6.1.2.tar.bz2
rm gmp.tar.bz2 cd gmp-6.1.2
cd gmp*
./configure --prefix=$QP_ROOT && make -j 8 ./configure --prefix=$QP_ROOT && make -j 8
make install make -j 8 install
EOF EOF
elif [[ ${PACKAGE} = libcap ]] ; then
download ${LIBCAP_URL} "${QP_ROOT}"/external/libcap.tar.gz
execute << EOF
cd "\${QP_ROOT}"/external
tar --gunzip --extract --file libcap.tar.gz
rm libcap.tar.gz
cd libcap-*/libcap
prefix=$QP_ROOT make install
EOF
elif [[ ${PACKAGE} = bwrap ]] ; then
download ${BUBBLE_URL} "${QP_ROOT}"/external/bwrap.tar.xz
execute << EOF
cd "\${QP_ROOT}"/external
tar --xz --extract --file bwrap.tar.xz
rm bwrap.tar.xz
cd bubblewrap*
./configure --prefix=$QP_ROOT && make -j 8
make install-exec-am
EOF
elif [[ ${PACKAGE} = irpf90 ]] ; then
# When changing version of irpf90, don't forget to update etc/irpf90.rc
download ${IRPF90_URL} "${QP_ROOT}"/external/irpf90.tar.gz
execute << EOF
cd "\${QP_ROOT}"/external
tar --gunzip --extract --file irpf90.tar.gz
rm irpf90.tar.gz
cd irpf90-*
make
EOF
elif [[ ${PACKAGE} = zeromq ]] ; then elif [[ ${PACKAGE} = zeromq ]] ; then
download ${ZEROMQ_URL} "${QP_ROOT}"/external/zeromq.tar.gz
execute << EOF execute << EOF
export CC=gcc export CC=gcc
export CXX=g++ export CXX=g++
cd "\${QP_ROOT}"/external cd "\${QP_ROOT}"/external
tar --gunzip --extract --file zeromq.tar.gz tar --gunzip --extract --file qp2-dependencies/zeromq-4.2.5.tar.gz
rm zeromq.tar.gz
cd zeromq-* cd zeromq-*
./configure --prefix="\$QP_ROOT" --without-libsodium --enable-libunwind=no ./configure --prefix="\$QP_ROOT" --without-libsodium --enable-libunwind=no
make make -j 8
make install make install
EOF EOF
elif [[ ${PACKAGE} = f77zmq ]] ; then elif [[ ${PACKAGE} = f77zmq ]] ; then
download ${F77ZMQ_URL} "${QP_ROOT}"/external/f77_zmq.tar.gz
execute << EOF execute << EOF
cd "\${QP_ROOT}"/external cd "\${QP_ROOT}"/external
tar --gunzip --extract --file f77_zmq.tar.gz tar --gunzip --extract --file qp2-dependencies/f77-zmq-4.3.2.tar.gz
rm f77_zmq.tar.gz cd f77-zmq-*
cd f77_zmq-* ./configure --prefix=\$QP_ROOT
export ZMQ_H="\$QP_ROOT"/include/zmq.h export ZMQ_H="\$QP_ROOT"/include/zmq.h
make make && make check && make install
cp libf77zmq.a "\${QP_ROOT}"/lib
cp libf77zmq.so "\${QP_ROOT}"/lib
cp f77_zmq_free.h "\${QP_ROOT}"/include
EOF EOF
elif [[ ${PACKAGE} = ocaml ]] ; then elif [[ ${PACKAGE} = ocaml ]] ; then
download ${OCAML_URL} "${QP_ROOT}"/external/opam_installer.sh execute <<EOF
source "${QP_ROOT}"/quantum_package.rc
if [[ -n ${TRAVIS} ]] ; then cd "${QP_ROOT}"/external/
# Special commands for Travis CI tar --gunzip --extract --file qp2-dependencies/ocaml-bundle_x86.tar.gz
chmod +x "${QP_ROOT}"/external/opam_installer.sh echo "" | ./ocaml-bundle/bootstrap.sh "${QP_ROOT}"
rm --force ${QP_ROOT}/bin/opam ./ocaml-bundle/configure.sh "${QP_ROOT}"
if [[ -n ${NO_CACHE} ]] ; then echo "" | ./ocaml-bundle/compile.sh "${QP_ROOT}"
rm -rf ${HOME}/.opam
fi
export OPAMROOT=${HOME}/.opam
cat << EOF | bash ${QP_ROOT}/external/opam_installer.sh --no-backup
${QP_ROOT}/bin
EOF EOF
rm ${QP_ROOT}/external/opam_installer.sh
# source ${OPAMROOT}/opam-init/init.sh > /dev/null 2> /dev/null || true
#
# opam switch create ocaml-base-compiler.4.10.0
opam init --verbose --yes --compiler=4.10.0 --disable-sandboxing
eval $(opam env)
opam install -y ${OCAML_PACKAGES} || exit 1
else
# Conventional commands
execute << EOF
chmod +x "${QP_ROOT}"/external/opam_installer.sh
"${QP_ROOT}"/external/opam_installer.sh --no-backup
EOF
execute << EOF
rm --force ${QP_ROOT}/bin/opam
export OPAMROOT=${OPAMROOT:-${QP_ROOT}/external/opam}
echo ${QP_ROOT}/bin \
| sh ${QP_ROOT}/external/opam_installer.sh
EOF
rm ${QP_ROOT}/external/opam_installer.sh
# source ${OPAMROOT}/opam-init/init.sh > /dev/null 2> /dev/null || true
# opam switch create ocaml-base-compiler.4.10.0 || exit 1
opam init --verbose --yes --compiler=4.10.0 --disable-sandboxing
eval $(opam env)
execute << EOF
opam install -y \${OCAML_PACKAGES} || exit 1
EOF
fi
elif [[ ${PACKAGE} = bse ]] ; then elif [[ ${PACKAGE} = bse ]] ; then
download ${BSE_URL} "${QP_ROOT}"/external/bse.tar.gz
execute << EOF execute << EOF
cd "\${QP_ROOT}"/external cd "\${QP_ROOT}"/external
tar --gunzip --extract --file bse.tar.gz tar --gunzip --extract --file qp2-dependencies/bse-v0.8.11.tar.gz
pip install -e basis_set_exchange-* pip install -e basis_set_exchange-*
EOF
elif [[ ${PACKAGE} = zlib ]] ; then elif [[ ${PACKAGE} = zlib ]] ; then
download ${ZLIB_URL} "${QP_ROOT}"/external/zlib.tar.gz
execute << EOF execute << EOF
cd "\${QP_ROOT}"/external cd "\${QP_ROOT}"/external
tar --gunzip --extract --file zlib.tar.gz tar --gunzip --extract --file qp2-dependencies/zlib-1.2.11.tar.gz
rm zlib.tar.gz && \
cd zlib-*/ cd zlib-*/
./configure --prefix=${QP_ROOT} && \ ./configure --prefix=${QP_ROOT} && \
make && make install make && make install
@ -380,35 +262,32 @@ EOF
elif [[ ${PACKAGE} = docopt ]] ; then elif [[ ${PACKAGE} = docopt ]] ; then
download ${DOCOPT_URL} "${QP_ROOT}"/external/docopt.tar.gz
execute << EOF execute << EOF
cd "\${QP_ROOT}"/external cd "\${QP_ROOT}"/external
tar --gunzip --extract --file docopt.tar.gz tar --gunzip --extract --file qp2-dependencies/docopt-0.6.2.tar.gz
mv docopt-*/docopt.py "\${QP_ROOT}/external/Python" mv docopt-*/docopt.py "\${QP_ROOT}/external/Python"
rm --recursive --force -- docopt-*/ docopt.tar.gz
EOF EOF
elif [[ ${PACKAGE} = resultsFile ]] ; then elif [[ ${PACKAGE} = resultsFile ]] ; then
download ${RESULTS_URL} "${QP_ROOT}"/external/resultsFile.tar.gz
execute << EOF execute << EOF
cd "\${QP_ROOT}"/external cd "\${QP_ROOT}"/external
tar --gunzip --extract --file resultsFile.tar.gz tar --gunzip --extract --file qp2-dependencies/resultsFile-v2.3.tar.gz
mv resultsFile-*/resultsFile "\${QP_ROOT}/external/Python/" mv resultsFile-*/resultsFile "\${QP_ROOT}/external/Python/"
rm --recursive --force resultsFile-* resultsFile.tar.gz
EOF EOF
elif [[ ${PACKAGE} = bats ]] ; then elif [[ ${PACKAGE} = bats ]] ; then
download ${BATS_URL} "${QP_ROOT}"/external/bats.tar.gz
execute << EOF execute << EOF
cd "\${QP_ROOT}"/external cd "\${QP_ROOT}"/external
tar -zxf bats.tar.gz tar -zxf qp2-dependencies/bats-v1.1.0.tar.gz
( cd bats-core-1.1.0/ ; ./install.sh \${QP_ROOT}) ( cd bats-core-1.1.0/ ; ./install.sh \${QP_ROOT})
rm --recursive --force -- bats-core-1.1.0 \ "\${QP_ROOT}"/external/bats.tar.gz
EOF EOF
else
error "${PACKAGE} unknown."
fail
fi fi
@ -422,12 +301,6 @@ if [[ ${NINJA} = $(not_found) ]] ; then
fail fail
fi fi
IRPF90=$(find_exe irpf90)
if [[ ${IRPF90} = $(not_found) ]] ; then
error "IRPf90 (irpf90) is not installed."
fail
fi
ZEROMQ=$(find_lib -lzmq) ZEROMQ=$(find_lib -lzmq)
if [[ ${ZEROMQ} = $(not_found) ]] ; then if [[ ${ZEROMQ} = $(not_found) ]] ; then
error "ZeroMQ (zeromq) is not installed." error "ZeroMQ (zeromq) is not installed."
@ -446,24 +319,6 @@ if [[ ${ZLIB} = $(not_found) ]] ; then
fail fail
fi fi
LIBCAP=$(find_lib -lcap)
if [[ ${LIBCAP} = $(not_found) ]] ; then
error "Libcap (libcap) is not installed."
fail
fi
BWRAP=$(find_exe bwrap)
if [[ ${BWRAP} = $(not_found) ]] ; then
error "Bubblewrap (bwrap) is not installed."
fail
fi
OPAM=$(find_exe opam)
if [[ ${OPAM} = $(not_found) ]] ; then
error "OPAM (ocaml) package manager is not installed."
fail
fi
OCAML=$(find_exe ocaml) OCAML=$(find_exe ocaml)
if [[ ${OCAML} = $(not_found) ]] ; then if [[ ${OCAML} = $(not_found) ]] ; then
error "OCaml (ocaml) compiler is not installed." error "OCaml (ocaml) compiler is not installed."