lib/scripts/getsettings
author haftmann
Thu Mar 14 13:54:31 2019 +0000 (5 weeks ago)
changeset 69910 0c0f7b4a72bf
parent 69444 c3c9440cbf9b
child 69926 110fff287217
permissions -rwxr-xr-x
dedicated environment setting for ocaml environment: ISABELLE_OPAM_ROOT is always present even if no envionrment is available
     1 # -*- shell-script -*- :mode=shellscript:
     2 #
     3 # Author: Makarius
     4 #
     5 # Static Isabelle environment for root of process tree.
     6 
     7 export ISABELLE_HOME
     8 
     9 export BASH_ENV="$ISABELLE_HOME/lib/scripts/getfunctions"
    10 source "$BASH_ENV"
    11 
    12 
    13 if [ -z "$ISABELLE_SETTINGS_PRESENT" ]
    14 then
    15 
    16 export ISABELLE_SETTINGS_PRESENT=true
    17 
    18 set -o allexport
    19 
    20 #sane environment defaults (notably on Mac OS X)
    21 if [ "$ISABELLE_APP" = true -a -x /usr/libexec/path_helper ]; then
    22   eval $(/usr/libexec/path_helper -s)
    23 fi
    24 
    25 #Cygwin vs. POSIX
    26 if [ "$OSTYPE" = cygwin ]
    27 then
    28   unset INI_DIR
    29 
    30   if [ -n "$TEMP_WINDOWS" ]; then
    31     TMPDIR="$(cygpath -u "$TEMP_WINDOWS")"
    32     TMP="$TMPDIR"
    33     TEMP="$TMPDIR"
    34   fi
    35 
    36   if [ -z "$USER_HOME" ]; then
    37     USER_HOME="$(cygpath -u "$USERPROFILE")"
    38   fi
    39 
    40   CYGWIN_ROOT="$(platform_path "/")"
    41   ISABELLE_ROOT="$(platform_path "$ISABELLE_HOME")"
    42 
    43   ISABELLE_CLASSPATH="$(cygpath -i -u -p "$CLASSPATH")"
    44   unset CLASSPATH
    45 else
    46   if [ -z "$USER_HOME" ]; then
    47     USER_HOME="$HOME"
    48   fi
    49 
    50   ISABELLE_ROOT="$ISABELLE_HOME"
    51 
    52   ISABELLE_CLASSPATH="$CLASSPATH"
    53   unset CLASSPATH
    54 fi
    55 
    56 #main executables
    57 ISABELLE_TOOL="$ISABELLE_HOME/bin/isabelle"
    58 ISABELLE_SCALA_SCRIPT="$ISABELLE_HOME/bin/isabelle_scala_script"
    59 PATH="$ISABELLE_HOME/bin:$PATH"
    60 
    61 #platform
    62 source "$ISABELLE_HOME/lib/scripts/isabelle-platform"
    63 if [ -z "$ISABELLE_PLATFORM" ]; then
    64   echo 1>&2 "Failed to determine hardware and operating system type!"
    65   exit 2
    66 fi
    67 
    68 #Isabelle distribution identifier -- filled in automatically!
    69 ISABELLE_ID=""
    70 [ -z "$ISABELLE_IDENTIFIER" ] && ISABELLE_IDENTIFIER=""
    71 
    72 
    73 # components
    74 
    75 ISABELLE_COMPONENTS=""
    76 ISABELLE_COMPONENTS_MISSING=""
    77 
    78 #main components
    79 init_component "$ISABELLE_HOME"
    80 [ -d "$ISABELLE_HOME/Admin" ] && init_component "$ISABELLE_HOME/Admin"
    81 if [ -d "$ISABELLE_HOME_USER" ]; then
    82   init_component "$ISABELLE_HOME_USER"
    83 else
    84   mkdir -p "$ISABELLE_HOME_USER"
    85   chmod $(umask -S) "$ISABELLE_HOME_USER"
    86 fi
    87 
    88 #POLYML_EXE
    89 if [ "$ISABELLE_PLATFORM_FAMILY" = "windows" ]; then
    90   POLYML_EXE="$ML_HOME/poly.exe"
    91 else
    92   POLYML_EXE="$ML_HOME/poly"
    93 fi
    94 
    95 #ML system identifier
    96 if [ -z "$ML_PLATFORM" ]; then
    97   ML_IDENTIFIER="$ML_SYSTEM"
    98 else
    99   ML_IDENTIFIER="${ML_SYSTEM}_${ML_PLATFORM}"
   100 fi
   101 
   102 #enforce ISABELLE_OCAML
   103 if [ -f "$ISABELLE_OPAM_ROOT/$ISABELLE_OCAML_VERSION/bin/ocaml" ]; then
   104   ISABELLE_OCAML="$ISABELLE_HOME/lib/scripts/ocaml"
   105 fi
   106 
   107 #enforce ISABELLE_OCAMLC
   108 if [ -f "$ISABELLE_OPAM_ROOT/$ISABELLE_OCAML_VERSION/bin/ocamlc" ]; then
   109   ISABELLE_OCAMLC="$ISABELLE_HOME/lib/scripts/ocamlc"
   110 fi
   111 
   112 #enforce ISABELLE_OCAMLEXEC
   113 if [ -d "$ISABELLE_OPAM_ROOT/$ISABELLE_OCAML_VERSION/bin" ]; then
   114   ISABELLE_OCAMLEXEC="$ISABELLE_HOME/lib/scripts/ocamlexec"
   115 fi
   116 
   117 #enforce ISABELLE_GHC
   118 if [ -d "$ISABELLE_STACK_ROOT" -a -f "$ISABELLE_STACK_ROOT/ISABELLE_GHC_PROGRAMS" ]; then
   119   if [ -f "$(cat "$ISABELLE_STACK_ROOT/ISABELLE_GHC_PROGRAMS")/$ISABELLE_GHC_VERSION/bin/ghc" ]; then
   120     ISABELLE_GHC="$ISABELLE_HOME/lib/scripts/ghc"
   121     ISABELLE_GHC_STACK=true
   122   fi
   123 fi
   124 
   125 #enforce JAVA_HOME
   126 if [ -d "$ISABELLE_JDK_HOME/jre" ]
   127 then
   128   export JAVA_HOME="$ISABELLE_JDK_HOME/jre"
   129 else
   130   export JAVA_HOME="$ISABELLE_JDK_HOME"
   131 fi
   132 
   133 set +o allexport
   134 
   135 fi