From 14656a288b8f7407985786a3ebf29e5027902f73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Henry?= Date: Tue, 19 Feb 2019 17:08:02 +0100 Subject: [PATCH] Make: add `make build-dev-deps` --- Makefile | 3 +++ docs/introduction/howtoget.rst | 16 ++++++++-------- scripts/install_build_deps.raw.sh | 8 +++++++- scripts/install_build_deps.sh | 15 +++++++++++++++ 4 files changed, 33 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 3ecfa730d..af128130d 100644 --- a/Makefile +++ b/Makefile @@ -81,6 +81,9 @@ fix-indent: build-deps: @./scripts/install_build_deps.sh +build-dev-deps: + @./scripts/install_build_deps.sh --dev + docker-image: @./scripts/create_docker_image.sh diff --git a/docs/introduction/howtoget.rst b/docs/introduction/howtoget.rst index 8678d5468..2200af25c 100644 --- a/docs/introduction/howtoget.rst +++ b/docs/introduction/howtoget.rst @@ -152,6 +152,14 @@ Install the OCaml compiler and the libraries which Tezos depends on: make build-deps +Alternatively, if you want to be able to install extra packages +(development packages such as `merlin`), you may use the following +command instead: + +:: + + make build-dev-deps + This command creates a local opam switch ``_opam`` where the right version of OCaml is compiled and installed (this takes a while but it's only done once). @@ -174,11 +182,3 @@ Lastly you can also add Tezos binaries to your ``PATH`` variable, activate bash autocompletion and after reading the Disclaimer a few hundred times you are allowed to disable it with ``TEZOS_CLIENT_UNSAFE_DISABLE_DISCLAIMER=Y``. - -To add the default opam repository at a lower priority (for example to -install merlin or test other opam packages), you can use the following -command: - -:: - - opam repo add default --rank=-1 diff --git a/scripts/install_build_deps.raw.sh b/scripts/install_build_deps.raw.sh index f150c5556..79e443b61 100755 --- a/scripts/install_build_deps.raw.sh +++ b/scripts/install_build_deps.raw.sh @@ -7,4 +7,10 @@ src_dir="$(dirname "$script_dir")" opams=$(find "$src_dir/vendors" "$src_dir/src" -name \*.opam -print) -opam install $opams --deps-only --with-test -y --criteria="-notuptodate,-changed,-removed" +export OPAMYES=${OPAMYES:=true} + +## In an ideal world, `--with-test` should be present only when using +## `--dev`. But this would probably break the CI, so we postponed this +## change until someone have some spare time. (@pirbo, @hnrgrgr) + +opam install $opams --deps-only --with-test --criteria="-notuptodate,-changed,-removed" diff --git a/scripts/install_build_deps.sh b/scripts/install_build_deps.sh index a576ca4b7..e4803c887 100755 --- a/scripts/install_build_deps.sh +++ b/scripts/install_build_deps.sh @@ -5,6 +5,12 @@ src_dir="$(dirname "$script_dir")" . "$script_dir"/version.sh +if [ "$1" = "--dev" ]; then + dev=yes +else + dev= +fi + opam repository set-url tezos --dont-select $opam_repository || \ opam repository add tezos --dont-select $opam_repository > /dev/null 2>&1 @@ -21,6 +27,10 @@ fi eval $(opam env --shell=sh) +if [ -n "$dev" ]; then + opam repository remove default > /dev/null 2>&1 || true +fi + if [ "$(ocaml -vnum)" != "$ocaml_version" ]; then opam install --unlock-base ocaml-base-compiler.$ocaml_version fi @@ -28,3 +38,8 @@ fi opam list --installed opam-depext || opam --yes install opam-depext "$script_dir"/install_build_deps.raw.sh + +if [ -n "$dev" ]; then + opam repository add default --rank=-1 > /dev/null 2>&1 || true + opam install merlin +fi