9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-12-21 11:03:29 +01:00

More portable install script

This commit is contained in:
Anthony Scemama 2021-11-16 23:35:30 +01:00
parent 7edfd4e326
commit 1b6fb2e607

53
configure vendored
View File

@ -3,8 +3,6 @@
# Quantum Package configuration script # Quantum Package configuration script
# #
TEMP=$(getopt -o d:c:i:h -l download:,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
@ -24,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
@ -68,32 +66,31 @@ function execute () {
} }
PACKAGES="" PACKAGES=""
echo $@
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 --help"
exit 2;; exit 2;;
esac esac
done done