lib/scripts/getsettings
author wenzelm
Wed Mar 20 21:57:02 2019 +0100 (2 months ago)
changeset 69930 b5286c564861
parent 69926 110fff287217
permissions -rwxr-xr-x
more robust reference to ghc exe (with multi-platform support);
     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_OCAMLFIND
   103 if [ -d "$ISABELLE_OPAM_ROOT/$ISABELLE_OCAML_VERSION/bin" ]; then
   104   ISABELLE_OCAMLFIND="$ISABELLE_HOME/lib/scripts/ocamlfind"
   105 fi
   106 
   107 #enforce ISABELLE_GHC
   108 if [ -f "$ISABELLE_STACK_ROOT/ISABELLE_GHC_EXE-$ISABELLE_PLATFORM_FAMILY" ]; then
   109   if [ -f "$(cat "$ISABELLE_STACK_ROOT/ISABELLE_GHC_EXE-$ISABELLE_PLATFORM_FAMILY")" ]; then
   110     ISABELLE_GHC="$ISABELLE_HOME/lib/scripts/ghc"
   111     ISABELLE_GHC_STACK=true
   112   fi
   113 fi
   114 
   115 #enforce JAVA_HOME
   116 if [ -d "$ISABELLE_JDK_HOME/jre" ]
   117 then
   118   export JAVA_HOME="$ISABELLE_JDK_HOME/jre"
   119 else
   120   export JAVA_HOME="$ISABELLE_JDK_HOME"
   121 fi
   122 
   123 set +o allexport
   124 
   125 fi