lib/Tools/ocaml_setup_base
author paulson <lp15@cam.ac.uk>
Wed, 26 Mar 2025 21:11:04 +0000
changeset 82351 882b80bd10c8
parent 81825 c551d4a418b9
permissions -rwxr-xr-x
More from Theta_Functions_Library
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
69135
be20f5f6feb9 support for OCaml via command-line tools;
wenzelm
parents:
diff changeset
     1
#!/usr/bin/env bash
be20f5f6feb9 support for OCaml via command-line tools;
wenzelm
parents:
diff changeset
     2
#
be20f5f6feb9 support for OCaml via command-line tools;
wenzelm
parents:
diff changeset
     3
# Author: Makarius
be20f5f6feb9 support for OCaml via command-line tools;
wenzelm
parents:
diff changeset
     4
#
81825
c551d4a418b9 provide less ambitious "isabelle ocaml_setup_base", notably for platforms without gmp-dev;
wenzelm
parents: 73405
diff changeset
     5
# DESCRIPTION: setup OCaml base compiler via OPAM
69135
be20f5f6feb9 support for OCaml via command-line tools;
wenzelm
parents:
diff changeset
     6
69911
036037573080 include zarith in the default opam setup
haftmann
parents: 69500
diff changeset
     7
set -e
036037573080 include zarith in the default opam setup
haftmann
parents: 69500
diff changeset
     8
69948
a591de179931 even more robust and conservative OCaml setup;
wenzelm
parents: 69942
diff changeset
     9
if [ -d "$ISABELLE_OPAM_ROOT/$ISABELLE_OCAML_VERSION/bin" ]
69139
4f3d93f0ba94 allow to switch ISABELLE_OCAML_VERSION later on;
wenzelm
parents: 69135
diff changeset
    10
then
69948
a591de179931 even more robust and conservative OCaml setup;
wenzelm
parents: 69942
diff changeset
    11
  isabelle_opam switch -y "$ISABELLE_OCAML_VERSION"
a591de179931 even more robust and conservative OCaml setup;
wenzelm
parents: 69942
diff changeset
    12
elif [ -e "$ISABELLE_OPAM_ROOT/config" ]
a591de179931 even more robust and conservative OCaml setup;
wenzelm
parents: 69942
diff changeset
    13
then
a591de179931 even more robust and conservative OCaml setup;
wenzelm
parents: 69942
diff changeset
    14
  isabelle_opam switch create -y "$ISABELLE_OCAML_VERSION"
69139
4f3d93f0ba94 allow to switch ISABELLE_OCAML_VERSION later on;
wenzelm
parents: 69135
diff changeset
    15
else
73405
8510c6e98228 more robust init: avoid spilling opam artifacts;
wenzelm
parents: 69948
diff changeset
    16
  mkdir -p "$ISABELLE_OPAM_ROOT"
8510c6e98228 more robust init: avoid spilling opam artifacts;
wenzelm
parents: 69948
diff changeset
    17
  cd "$ISABELLE_OPAM_ROOT"
69942
2c48be88f847 further robustification (amending 772bdd1ed843);
wenzelm
parents: 69938
diff changeset
    18
  isabelle_opam init -y --disable-sandboxing --no-setup --compiler="$ISABELLE_OCAML_VERSION"
69139
4f3d93f0ba94 allow to switch ISABELLE_OCAML_VERSION later on;
wenzelm
parents: 69135
diff changeset
    19
fi