ligo/scripts/install_build_deps.sh

72 lines
1.5 KiB
Bash
Raw Normal View History

#! /bin/sh
2016-09-08 21:13:10 +04:00
script_dir="$(dirname "$(readlink -f "$0")")"
src_dir="$(dirname "$script_dir")"
. "$script_dir/version.sh"
if [ "$(ocaml -vnum)" != "$ocaml_version" ]; then
echo ;
echo " Unexpected compiler version ($(ocaml -vnum))";
echo " You should use ocaml-$ocaml_version.";
echo ;
exit 1;
2016-09-08 21:13:10 +04:00
fi
cmd="$1"
if [ -z "$cmd" ]; then cmd=all; fi
2016-09-08 21:13:10 +04:00
pin=false
depext=false
install=false
case $cmd in
2016-09-08 21:13:10 +04:00
pin)
pin=true
;;
2016-09-08 21:13:10 +04:00
depext)
depext=true
;;
2016-09-08 21:13:10 +04:00
install)
install=true
;;
2016-09-08 21:13:10 +04:00
all)
pin=true
depext=true
install=true
;;
2016-09-08 21:13:10 +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
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
opam pin --yes add --no-action --dev-repo cohttp
2017-02-24 20:12:13 +04:00
opam pin add typerex-build --dev --no-action
## Force opam to take account of the new `tezos-deps.opam`
opam pin --yes remove tezos-deps
2016-09-08 21:13:10 +04:00
opam pin --yes add --no-action tezos-deps src
fi
if "$depext"; then
2016-09-08 21:13:10 +04:00
opam list --installed depext || opam install depext
opam depext $DEPEXTOPT tezos-deps
2016-09-08 21:13:10 +04:00
fi
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