Commit 611950dc authored by Julien Lopez's avatar Julien Lopez

opam_config.sh improved

parent c17e4eeb
......@@ -6,45 +6,41 @@ OCAMLFOLDER="ocaml"
usage ()
{
echo "$0 [--verbose|-v] [--mliface=DIR] ocamlversion"
echo "Usage: $0 [OPTION]... [MLVERSION]"
echo "Configures opam for the compilation of CDuce."
echo "Switches the OCaml version of opam if MLVERSION is provided."
echo "Example: $0 --verbose --mliface=ocaml 4.01.0"
echo "Valid options are:"
echo "\t-v, --verbose\tactivate verbose mode"
echo "\t--mliface=DIR\tcheckout the OCaml sources in DIR to MLVERSION"
echo "\t-h, --help\tdisplay this help and exit"
}
while test $# -ge 1; do
if test $1 = "-v" || test $1 = "--verbose"; then VERBOSE="true";
elif echo $1 | grep -qs "\-\-mliface=*"; then
elif echo $1 | grep -qse "--mliface=.*"; then
WITHOCAML="true"; OCAMLFOLDER=`echo $1 | cut -d '=' -f 2`;
elif test $1 = "-h" || test $1 = "--help"; then usage; exit 0;
elif echo $1 | grep -qse "-.*"; then usage; exit 1;
else break; fi;
shift;
done
if test $# -lt 1; then usage; exit 1; fi
if test $# -ge 1; then
echo -n "Switching to version $1 of OCaml..."
if test $VERBOSE = "false"; then
echo -n "Switching to version $1 of OCaml..."
opam switch $1 > /dev/null 2>&1
else
opam switch $1
fi
if test $? -ne 0; then
echo "failed. This version doesn't seem to exist."; exit 2;
fi
if test $? -ne 0; then
echo "failed. This version doesn't seem to exist."; exit 2;
fi
echo "done."
echo "done."
if test $VERBOSE = "false"; then
eval `opam config env` > /dev/null 2>&1
else
eval `opam config env`
echo "# To complete the configuration of OPAM, you need to run:"
echo "eval \`opam config env\`"
fi
#if test $? -ne 0; then
echo "Warning: Could not complete the configuration of opam, type:"
echo "eval \`opam config env\`";
#fi
echo "Installing mandatory packages to compile CDuce."
opam install pcre-ocaml
opam install ocamlnet
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment