diff --git a/build-infer.sh b/build-infer.sh index 0ed252157..813dd29d2 100755 --- a/build-infer.sh +++ b/build-infer.sh @@ -121,7 +121,7 @@ fi setup_opam () { opam var root 1>/dev/null 2>/dev/null || opam init --reinit --bare --no-setup - opam_switch_create_if_needed "$INFER_OPAM_SWITCH" + opam_switch_create_if_needed "$INFER_OPAM_SWITCH" "$INFER_OPAM_COMPILER" opam switch set "$INFER_OPAM_SWITCH" } diff --git a/scripts/opam_utils.sh b/scripts/opam_utils.sh index 0c3af420c..07b26be50 100644 --- a/scripts/opam_utils.sh +++ b/scripts/opam_utils.sh @@ -50,6 +50,7 @@ opam_require_version_2 () { # assumes opam is available and initialized opam_switch_create_if_needed () { local switch=$1 + local compiler=$2 local switch_exists=no for installed_switch in $(opam switch list --short); do if [ "$installed_switch" == "$switch" ]; then @@ -58,7 +59,7 @@ opam_switch_create_if_needed () { fi done if [ "$switch_exists" = "no" ]; then - opam switch create "$switch" + opam switch create "$switch" "$compiler" fi }