lib/scripts/getsettings
author wenzelm
Thu Feb 25 17:49:04 2016 +0100 (2016-02-25)
changeset 62412 ffdc5cf36dc5
parent 62354 fdd6989cc8a0
child 62413 c6111df4a4f8
permissions -rwxr-xr-x
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
     1 # -*- shell-script -*- :mode=shellscript:
     2 #
     3 # Author: Makarius
     4 #
     5 # Static Isabelle environment for root of process tree.
     6 
     7 if [ -z "$ISABELLE_SETTINGS_PRESENT" ]
     8 then
     9 
    10 set -o allexport
    11 
    12 ISABELLE_SETTINGS_PRESENT=true
    13 
    14 BASH_ENV="$ISABELLE_HOME/lib/scripts/getfunctions"
    15 source "$BASH_ENV"
    16 set -o allexport
    17 
    18 #sane environment defaults (notably on Mac OS X)
    19 if [ "$ISABELLE_APP" = true -a -x /usr/libexec/path_helper ]; then
    20   eval $(/usr/libexec/path_helper -s)
    21 fi
    22 
    23 #Cygwin vs. POSIX
    24 if [ "$OSTYPE" = cygwin ]
    25 then
    26   unset INI_DIR
    27 
    28   if [ -n "$TEMP_WINDOWS" ]; then
    29     TMPDIR="$(cygpath -u "$TEMP_WINDOWS")"
    30     TMP="$TMPDIR"
    31     TEMP="$TMPDIR"
    32   fi
    33 
    34   if [ -z "$USER_HOME" ]; then
    35     USER_HOME="$(cygpath -u "$USERPROFILE")"
    36   fi
    37 
    38   CYGWIN_ROOT="$(platform_path "/")"
    39   ISABELLE_ROOT="$(platform_path "$ISABELLE_HOME")"
    40 
    41   ISABELLE_CLASSPATH="$(cygpath -i -u -p "$CLASSPATH")"
    42   unset CLASSPATH
    43 else
    44   if [ -z "$USER_HOME" ]; then
    45     USER_HOME="$HOME"
    46   fi
    47 
    48   ISABELLE_ROOT="$ISABELLE_HOME"
    49 
    50   ISABELLE_CLASSPATH="$CLASSPATH"
    51   unset CLASSPATH
    52 fi
    53 
    54 export ISABELLE_HOME
    55 
    56 #main executables
    57 ISABELLE_TOOL="$ISABELLE_HOME/bin/isabelle"
    58 ISABELLE_PROCESS="$ISABELLE_HOME/bin/isabelle_process"
    59 ISABELLE_SCALA_SCRIPT="$ISABELLE_HOME/bin/isabelle_scala_script"
    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 #ML system identifier
    89 if [ -z "$ML_PLATFORM" ]; then
    90   ML_IDENTIFIER="$ML_SYSTEM"
    91 else
    92   ML_IDENTIFIER="${ML_SYSTEM}_${ML_PLATFORM}"
    93 fi
    94 
    95 ISABELLE_OUTPUT="$ISABELLE_OUTPUT/$ML_IDENTIFIER"
    96 
    97 #enforce JAVA_HOME
    98 export JAVA_HOME="$ISABELLE_JDK_HOME/jre"
    99 
   100 set +o allexport
   101 
   102 fi