2016-11-23 13:54:22 +04:00
|
|
|
#! /bin/sh
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-04-12 14:55:01 +04:00
|
|
|
script_dir="$(cd "$(dirname "$0")" && echo "$(pwd -P)/")"
|
2017-01-22 04:59:18 +04:00
|
|
|
src_dir="$(dirname "$script_dir")"
|
|
|
|
|
|
|
|
. "$script_dir/version.sh"
|
|
|
|
|
|
|
|
if [ "$(ocaml -vnum)" != "$ocaml_version" ]; then
|
2016-11-23 13:54:22 +04:00
|
|
|
echo ;
|
|
|
|
echo " Unexpected compiler version ($(ocaml -vnum))";
|
2017-01-22 04:59:18 +04:00
|
|
|
echo " You should use ocaml-$ocaml_version.";
|
2016-11-23 13:54:22 +04:00
|
|
|
echo ;
|
|
|
|
exit 1;
|
2016-09-08 21:13:10 +04:00
|
|
|
fi
|
|
|
|
|
2016-12-08 20:19:44 +04:00
|
|
|
cmd="$1"
|
|
|
|
if [ -z "$cmd" ]; then cmd=all; fi
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2016-11-23 13:54:22 +04:00
|
|
|
pin=false
|
|
|
|
depext=false
|
|
|
|
install=false
|
|
|
|
|
|
|
|
case $cmd in
|
2016-09-08 21:13:10 +04:00
|
|
|
pin)
|
2016-11-23 13:54:22 +04:00
|
|
|
pin=true
|
|
|
|
;;
|
2016-09-08 21:13:10 +04:00
|
|
|
depext)
|
2016-11-23 13:54:22 +04:00
|
|
|
depext=true
|
|
|
|
;;
|
2016-09-08 21:13:10 +04:00
|
|
|
install)
|
2016-11-23 13:54:22 +04:00
|
|
|
install=true
|
|
|
|
;;
|
2016-09-08 21:13:10 +04:00
|
|
|
all)
|
2016-11-23 13:54:22 +04:00
|
|
|
pin=true
|
|
|
|
depext=true
|
|
|
|
install=true
|
|
|
|
;;
|
2016-09-08 21:13:10 +04:00
|
|
|
*)
|
2016-12-08 20:19:44 +04:00
|
|
|
echo "Unknown command '$cmd'."
|
|
|
|
echo "Usage: $0 [pin|depext|install|all|]"
|
|
|
|
exit 1
|
2016-09-08 21:13:10 +04:00
|
|
|
esac
|
|
|
|
|
|
|
|
set -e
|
|
|
|
set -x
|
|
|
|
|
2016-11-23 13:54:22 +04:00
|
|
|
if "$pin"; then
|
2016-09-08 21:13:10 +04:00
|
|
|
opam pin --yes remove --no-action --dev-repo ocplib-resto || true
|
|
|
|
opam pin --yes add --no-action --dev-repo sodium
|
|
|
|
opam pin --yes add --no-action --dev-repo ocp-ocamlres
|
2016-11-09 14:40:01 +04:00
|
|
|
opam pin --yes add --no-action --dev-repo ocplib-json-typed
|
2016-09-08 21:13:10 +04:00
|
|
|
opam pin --yes add --no-action --dev-repo ocplib-resto
|
2017-05-07 13:56:30 +04:00
|
|
|
opam pin --yes add --no-action ocp-build 1.99.18-beta ## TMP fix
|
2017-02-24 20:12:13 +04:00
|
|
|
opam pin add typerex-build --dev --no-action
|
2016-12-08 19:27:28 +04:00
|
|
|
## Force opam to take account of the new `tezos-deps.opam`
|
|
|
|
opam pin --yes remove tezos-deps
|
2017-04-12 14:55:01 +04:00
|
|
|
opam pin --yes add --no-action tezos-deps $src_dir/src
|
2016-09-08 21:13:10 +04:00
|
|
|
fi
|
|
|
|
|
2016-11-23 13:54:22 +04:00
|
|
|
if "$depext"; then
|
2016-09-08 21:13:10 +04:00
|
|
|
opam list --installed depext || opam install depext
|
2016-11-23 13:54:22 +04:00
|
|
|
opam depext $DEPEXTOPT tezos-deps
|
2016-09-08 21:13:10 +04:00
|
|
|
fi
|
|
|
|
|
2016-11-23 13:54:22 +04:00
|
|
|
if "$install"; then
|
|
|
|
if opam list --installed tezos-deps ; then
|
|
|
|
opam upgrade $(opam list -s --required-by tezos-deps | grep -ve '^ocaml *$')
|
|
|
|
else
|
|
|
|
opam install tezos-deps
|
|
|
|
fi
|
2016-09-08 21:13:10 +04:00
|
|
|
fi
|