Skip to content

Commit

Permalink
Use opam 2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
jonahbeckford committed Jun 27, 2024
1 parent 0814ca0 commit 069fd02
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/unix/private/init-opam-root.sh
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ fi

# ------------------
# BEGIN Feature flags
DKML_FEATURE_FLAG_POST_OPAM_2_2_BETA2=${DKML_FEATURE_FLAG_POST_OPAM_2_2_BETA2:-}
DKML_FEATURE_FLAG_POST_OPAM_2_2_BETA2=${DKML_FEATURE_FLAG_POST_OPAM_2_2_BETA2:-ON}

if [ "$DKML_FEATURE_FLAG_POST_OPAM_2_2_BETA2" = ON ]; then
echo "Using feature flag: DKML_FEATURE_FLAG_POST_OPAM_2_2_BETA2"
Expand Down Expand Up @@ -152,6 +152,25 @@ fi
# Set DKMLSYS_AWK and other things
autodetect_system_binaries

# Get the OCaml version
if [ -x /usr/bin/cygpath ]; then
# If OCAMLVERSION_OR_HOME=C:/x/y/z then match against /c/x/y/z
OCAMLVERSION_OR_HOME_UNIX=$(/usr/bin/cygpath -u "$OCAMLVERSION_OR_HOME")
else
OCAMLVERSION_OR_HOME_UNIX="$OCAMLVERSION_OR_HOME"
fi
case "$OCAMLVERSION_OR_HOME_UNIX" in
/* | ?:*) # /a/b/c or C:\Windows
validate_and_explore_ocamlhome "$OCAMLVERSION_OR_HOME"
# the `awk ...` is dos2unix equivalent
"$DKML_OCAMLHOME_ABSBINDIR_UNIX/ocamlc" -version > "$WORK/ocamlc.version"
OCAMLVERSION=$(awk '{ sub(/\r$/,""); print }' "$WORK/ocamlc.version")
;;
*)
OCAMLVERSION="$OCAMLVERSION_OR_HOME"
;;
esac

# -----------------------
# BEGIN install opam repositories

Expand Down Expand Up @@ -483,6 +502,7 @@ if [ -n "${MSYSTEM:-}" ] && [ -x /usr/bin/cygpath ]; then

fi
fi
run_opam var --global "sys-ocaml-version=$OCAMLVERSION"

# Diagnostics
log_trace echo '=== opam repository list --all ==='
Expand Down

0 comments on commit 069fd02

Please sign in to comment.