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;
wenzelm@25434
     1
# -*- shell-script -*- :mode=shellscript:
wenzelm@29145
     2
#
wenzelm@62412
     3
# Author: Makarius
wenzelm@2299
     4
#
wenzelm@62412
     5
# Static Isabelle environment for root of process tree.
wenzelm@2299
     6
wenzelm@7770
     7
if [ -z "$ISABELLE_SETTINGS_PRESENT" ]
wenzelm@7770
     8
then
wenzelm@7770
     9
wenzelm@3185
    10
set -o allexport
wenzelm@3185
    11
wenzelm@7770
    12
ISABELLE_SETTINGS_PRESENT=true
wenzelm@7770
    13
wenzelm@62412
    14
BASH_ENV="$ISABELLE_HOME/lib/scripts/getfunctions"
wenzelm@62412
    15
source "$BASH_ENV"
wenzelm@62412
    16
set -o allexport
wenzelm@53913
    17
wenzelm@57411
    18
#sane environment defaults (notably on Mac OS X)
wenzelm@57411
    19
if [ "$ISABELLE_APP" = true -a -x /usr/libexec/path_helper ]; then
wenzelm@57411
    20
  eval $(/usr/libexec/path_helper -s)
wenzelm@57411
    21
fi
wenzelm@57411
    22
wenzelm@48838
    23
#Cygwin vs. POSIX
wenzelm@47461
    24
if [ "$OSTYPE" = cygwin ]
wenzelm@47461
    25
then
wenzelm@53970
    26
  unset INI_DIR
wenzelm@53970
    27
wenzelm@58640
    28
  if [ -n "$TEMP_WINDOWS" ]; then
wenzelm@58640
    29
    TMPDIR="$(cygpath -u "$TEMP_WINDOWS")"
wenzelm@58640
    30
    TMP="$TMPDIR"
wenzelm@58640
    31
    TEMP="$TMPDIR"
wenzelm@58640
    32
  fi
wenzelm@58640
    33
wenzelm@47661
    34
  if [ -z "$USER_HOME" ]; then
wenzelm@60531
    35
    USER_HOME="$(cygpath -u "$USERPROFILE")"
wenzelm@47661
    36
  fi
wenzelm@47661
    37
wenzelm@61294
    38
  CYGWIN_ROOT="$(platform_path "/")"
wenzelm@61294
    39
  ISABELLE_ROOT="$(platform_path "$ISABELLE_HOME")"
wenzelm@53576
    40
wenzelm@53576
    41
  ISABELLE_CLASSPATH="$(cygpath -i -u -p "$CLASSPATH")"
wenzelm@53576
    42
  unset CLASSPATH
wenzelm@47461
    43
else
wenzelm@47661
    44
  if [ -z "$USER_HOME" ]; then
wenzelm@47661
    45
    USER_HOME="$HOME"
wenzelm@47661
    46
  fi
wenzelm@47661
    47
wenzelm@61293
    48
  ISABELLE_ROOT="$ISABELLE_HOME"
wenzelm@61293
    49
wenzelm@53576
    50
  ISABELLE_CLASSPATH="$CLASSPATH"
wenzelm@53576
    51
  unset CLASSPATH
wenzelm@47461
    52
fi
wenzelm@47461
    53
wenzelm@15972
    54
export ISABELLE_HOME
wenzelm@2736
    55
wenzelm@62412
    56
#main executables
wenzelm@56440
    57
ISABELLE_TOOL="$ISABELLE_HOME/bin/isabelle"
wenzelm@56439
    58
ISABELLE_PROCESS="$ISABELLE_HOME/bin/isabelle_process"
wenzelm@56448
    59
ISABELLE_SCALA_SCRIPT="$ISABELLE_HOME/bin/isabelle_scala_script"
wenzelm@56440
    60
wenzelm@36196
    61
#platform
wenzelm@41758
    62
source "$ISABELLE_HOME/lib/scripts/isabelle-platform"
wenzelm@48455
    63
if [ -z "$ISABELLE_PLATFORM" ]; then
wenzelm@48455
    64
  echo 1>&2 "Failed to determine hardware and operating system type!"
wenzelm@48455
    65
  exit 2
wenzelm@48455
    66
fi
wenzelm@36196
    67
wenzelm@25434
    68
#Isabelle distribution identifier -- filled in automatically!
wenzelm@41511
    69
ISABELLE_ID=""
wenzelm@48837
    70
[ -z "$ISABELLE_IDENTIFIER" ] && ISABELLE_IDENTIFIER=""
wenzelm@21490
    71
wenzelm@48838
    72
wenzelm@48838
    73
# components
wenzelm@48838
    74
wenzelm@32305
    75
ISABELLE_COMPONENTS=""
wenzelm@48838
    76
ISABELLE_COMPONENTS_MISSING=""
wenzelm@48838
    77
wenzelm@32305
    78
#main components
wenzelm@32305
    79
init_component "$ISABELLE_HOME"
wenzelm@48725
    80
[ -d "$ISABELLE_HOME/Admin" ] && init_component "$ISABELLE_HOME/Admin"
wenzelm@61319
    81
if [ -d "$ISABELLE_HOME_USER" ]; then
wenzelm@61319
    82
  init_component "$ISABELLE_HOME_USER"
wenzelm@61319
    83
else
wenzelm@61319
    84
  mkdir -p "$ISABELLE_HOME_USER"
wenzelm@61319
    85
  chmod $(umask -S) "$ISABELLE_HOME_USER"
wenzelm@61319
    86
fi
wenzelm@48838
    87
wenzelm@21490
    88
#ML system identifier
wenzelm@6413
    89
if [ -z "$ML_PLATFORM" ]; then
wenzelm@6413
    90
  ML_IDENTIFIER="$ML_SYSTEM"
wenzelm@6413
    91
else
wenzelm@6413
    92
  ML_IDENTIFIER="${ML_SYSTEM}_${ML_PLATFORM}"
wenzelm@6413
    93
fi
wenzelm@21468
    94
wenzelm@48838
    95
ISABELLE_OUTPUT="$ISABELLE_OUTPUT/$ML_IDENTIFIER"
wenzelm@48838
    96
wenzelm@47748
    97
#enforce JAVA_HOME
wenzelm@58791
    98
export JAVA_HOME="$ISABELLE_JDK_HOME/jre"
wenzelm@47748
    99
wenzelm@2299
   100
set +o allexport
wenzelm@7770
   101
wenzelm@7770
   102
fi