dedicated environment setting for ocaml environment: ISABELLE_OPAM_ROOT is always present even if no envionrment is available
authorhaftmann
Thu, 14 Mar 2019 13:54:31 +0000
changeset 69910 0c0f7b4a72bf
parent 69909 5382f5691a11
child 69911 036037573080
dedicated environment setting for ocaml environment: ISABELLE_OPAM_ROOT is always present even if no envionrment is available
lib/scripts/getsettings
src/Tools/Code/code_ml.ML
--- a/lib/scripts/getsettings	Thu Mar 14 09:46:09 2019 +0100
+++ b/lib/scripts/getsettings	Thu Mar 14 13:54:31 2019 +0000
@@ -109,6 +109,11 @@
   ISABELLE_OCAMLC="$ISABELLE_HOME/lib/scripts/ocamlc"
 fi
 
+#enforce ISABELLE_OCAMLEXEC
+if [ -d "$ISABELLE_OPAM_ROOT/$ISABELLE_OCAML_VERSION/bin" ]; then
+  ISABELLE_OCAMLEXEC="$ISABELLE_HOME/lib/scripts/ocamlexec"
+fi
+
 #enforce ISABELLE_GHC
 if [ -d "$ISABELLE_STACK_ROOT" -a -f "$ISABELLE_STACK_ROOT/ISABELLE_GHC_PROGRAMS" ]; then
   if [ -f "$(cat "$ISABELLE_STACK_ROOT/ISABELLE_GHC_PROGRAMS")/$ISABELLE_GHC_VERSION/bin/ghc" ]; then
--- a/src/Tools/Code/code_ml.ML	Thu Mar 14 09:46:09 2019 +0100
+++ b/src/Tools/Code/code_ml.ML	Thu Mar 14 13:54:31 2019 +0000
@@ -885,11 +885,11 @@
       evaluation_args = []})
   #> Code_Target.add_language
     (target_OCaml, {serializer = serializer_ocaml, literals = literals_ocaml,
-      check = {env_var = "ISABELLE_OPAM_ROOT",
+      check = {env_var = "ISABELLE_OCAMLEXEC",
         make_destination = fn p => Path.append p (Path.explode "ROOT.ml")
           (*extension demanded by OCaml compiler*),
         make_command = fn _ =>
-          "\"$ISABELLE_ROOT/lib/scripts/ocamlexec\" ocamlfind ocamlopt -w pu -package zarith -linkpkg ROOT.ml"},
+          "\"$ISABELLE_OCAMLEXEC\" ocamlfind ocamlopt -w pu -package zarith -linkpkg ROOT.ml"},
       evaluation_args = []})
   #> Code_Target.set_printings (Type_Constructor ("fun",
     [(target_SML, SOME (2, fun_syntax)), (target_OCaml, SOME (2, fun_syntax))]))