lib/scripts/getsettings
author wenzelm
Thu, 21 Aug 2008 13:05:28 +0200
changeset 27934 7d12a7e3cc55
parent 27914 9a7f17370ffb
child 27940 002718f9c938
permissions -rw-r--r--
added ISABELLE_ROOT_JVM; removed obsolete ISABELLE_HOME_JVM, ISABELLE_HOME_USER_JVM;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
25434
746677c843a7 ISABELLE_IDENTIFIER is filled in automatically, not taken from the *long* form of isatool version!
wenzelm
parents: 21490
diff changeset
     1
# -*- shell-script -*- :mode=shellscript:
2307
508d2a233dbc *** empty log message ***
wenzelm
parents: 2299
diff changeset
     2
# $Id$
9789
wenzelm
parents: 9680
diff changeset
     3
# Author: Markus Wenzel, TU Muenchen
2299
ed9720047d53 getsettings: bash source script to augment current env.
wenzelm
parents:
diff changeset
     4
#
2348
b51e104ecf40 *** empty log message ***
wenzelm
parents: 2307
diff changeset
     5
# getsettings - bash source script to augment current env.
2299
ed9720047d53 getsettings: bash source script to augment current env.
wenzelm
parents:
diff changeset
     6
7770
0497323c1f0b ISABELLE_SETTINGS_PRESENT: avoid multiple invocation;
wenzelm
parents: 6413
diff changeset
     7
if [ -z "$ISABELLE_SETTINGS_PRESENT" ]
0497323c1f0b ISABELLE_SETTINGS_PRESENT: avoid multiple invocation;
wenzelm
parents: 6413
diff changeset
     8
then
0497323c1f0b ISABELLE_SETTINGS_PRESENT: avoid multiple invocation;
wenzelm
parents: 6413
diff changeset
     9
3185
wenzelm
parents: 3118
diff changeset
    10
set -o allexport
wenzelm
parents: 3118
diff changeset
    11
7770
0497323c1f0b ISABELLE_SETTINGS_PRESENT: avoid multiple invocation;
wenzelm
parents: 6413
diff changeset
    12
ISABELLE_SETTINGS_PRESENT=true
0497323c1f0b ISABELLE_SETTINGS_PRESENT: avoid multiple invocation;
wenzelm
parents: 6413
diff changeset
    13
15972
8ac3803c8f73 export ISABELLE_HOME, do not normalize;
wenzelm
parents: 15849
diff changeset
    14
export ISABELLE_HOME
12598
fa556d3fe5f2 warn for spaces in ISABELLE_HOME;
wenzelm
parents: 11553
diff changeset
    15
if { echo -n "$ISABELLE_HOME" | fgrep " " >/dev/null; }
fa556d3fe5f2 warn for spaces in ISABELLE_HOME;
wenzelm
parents: 11553
diff changeset
    16
then
fa556d3fe5f2 warn for spaces in ISABELLE_HOME;
wenzelm
parents: 11553
diff changeset
    17
  echo 1>&2 "### White space in ISABELLE_HOME may cause strange problems later on!"
fa556d3fe5f2 warn for spaces in ISABELLE_HOME;
wenzelm
parents: 11553
diff changeset
    18
  echo 1>&2 "### ISABELLE_HOME=\"$ISABELLE_HOME\""
fa556d3fe5f2 warn for spaces in ISABELLE_HOME;
wenzelm
parents: 11553
diff changeset
    19
fi
2736
476adc742599 added ISABELLE_HOME normalization;
wenzelm
parents: 2643
diff changeset
    20
11553
wenzelm
parents: 9789
diff changeset
    21
#key executables
wenzelm
parents: 9789
diff changeset
    22
ISABELLE="$ISABELLE_HOME/bin/isabelle-process"
9789
wenzelm
parents: 9680
diff changeset
    23
ISATOOL="$ISABELLE_HOME/bin/isatool"
2299
ed9720047d53 getsettings: bash source script to augment current env.
wenzelm
parents:
diff changeset
    24
25434
746677c843a7 ISABELLE_IDENTIFIER is filled in automatically, not taken from the *long* form of isatool version!
wenzelm
parents: 21490
diff changeset
    25
#Isabelle distribution identifier -- filled in automatically!
746677c843a7 ISABELLE_IDENTIFIER is filled in automatically, not taken from the *long* form of isatool version!
wenzelm
parents: 21490
diff changeset
    26
ISABELLE_IDENTIFIER=""
21490
2f83b11c301b added ISABELLE_IDENTIFIER;
wenzelm
parents: 21468
diff changeset
    27
2643
a7f469c0ba59 tuned comments;
wenzelm
parents: 2621
diff changeset
    28
#users tend to put strange things in here ...
2621
e9e491033b54 globally unset ENV, BASH_ENV;
wenzelm
parents: 2590
diff changeset
    29
unset ENV
e9e491033b54 globally unset ENV, BASH_ENV;
wenzelm
parents: 2590
diff changeset
    30
unset BASH_ENV
e9e491033b54 globally unset ENV, BASH_ENV;
wenzelm
parents: 2590
diff changeset
    31
9680
6581bfc8421e choosefrom: support easy settings;
wenzelm
parents: 9227
diff changeset
    32
#support easy settings
6581bfc8421e choosefrom: support easy settings;
wenzelm
parents: 9227
diff changeset
    33
function choosefrom ()
6581bfc8421e choosefrom: support easy settings;
wenzelm
parents: 9227
diff changeset
    34
{
6581bfc8421e choosefrom: support easy settings;
wenzelm
parents: 9227
diff changeset
    35
  local RESULT=""
6581bfc8421e choosefrom: support easy settings;
wenzelm
parents: 9227
diff changeset
    36
  local FILE=""
6581bfc8421e choosefrom: support easy settings;
wenzelm
parents: 9227
diff changeset
    37
6581bfc8421e choosefrom: support easy settings;
wenzelm
parents: 9227
diff changeset
    38
  for FILE in "$@"
6581bfc8421e choosefrom: support easy settings;
wenzelm
parents: 9227
diff changeset
    39
  do
6581bfc8421e choosefrom: support easy settings;
wenzelm
parents: 9227
diff changeset
    40
    [ -z "$RESULT" -a -e "$FILE" ] && RESULT="$FILE"
6581bfc8421e choosefrom: support easy settings;
wenzelm
parents: 9227
diff changeset
    41
  done
6581bfc8421e choosefrom: support easy settings;
wenzelm
parents: 9227
diff changeset
    42
6581bfc8421e choosefrom: support easy settings;
wenzelm
parents: 9227
diff changeset
    43
  [ -z "$RESULT" ] && RESULT="$FILE"
6581bfc8421e choosefrom: support easy settings;
wenzelm
parents: 9227
diff changeset
    44
  echo "$RESULT"
6581bfc8421e choosefrom: support easy settings;
wenzelm
parents: 9227
diff changeset
    45
}
6581bfc8421e choosefrom: support easy settings;
wenzelm
parents: 9227
diff changeset
    46
27914
9a7f17370ffb refined scala/java wrappers via isatool;
wenzelm
parents: 27911
diff changeset
    47
#JVM path wrapper
25650
ce061f5083d7 added javapath (for cygwin);
wenzelm
parents: 25434
diff changeset
    48
if [ "$OSTYPE" = cygwin ]; then
27908
97f8b7c0f420 refined JVM path wrappers: Isabelle environment holds Unix version of CLASSPATH, javawrapper/scalawrapper convert it back;
wenzelm
parents: 25650
diff changeset
    49
  CLASSPATH="$(cygpath -u -p "$CLASSPATH")"
97f8b7c0f420 refined JVM path wrappers: Isabelle environment holds Unix version of CLASSPATH, javawrapper/scalawrapper convert it back;
wenzelm
parents: 25650
diff changeset
    50
  function jvmpath() { cygpath -w -p "$@"; }
27934
7d12a7e3cc55 added ISABELLE_ROOT_JVM;
wenzelm
parents: 27914
diff changeset
    51
  ISABELLE_ROOT_JVM="/"
25650
ce061f5083d7 added javapath (for cygwin);
wenzelm
parents: 25434
diff changeset
    52
else
27908
97f8b7c0f420 refined JVM path wrappers: Isabelle environment holds Unix version of CLASSPATH, javawrapper/scalawrapper convert it back;
wenzelm
parents: 25650
diff changeset
    53
  function jvmpath() { echo "$@"; }
27934
7d12a7e3cc55 added ISABELLE_ROOT_JVM;
wenzelm
parents: 27914
diff changeset
    54
  ISABELLE_ROOT_JVM="$(jvmpath "/")"
25650
ce061f5083d7 added javapath (for cygwin);
wenzelm
parents: 25434
diff changeset
    55
fi
ce061f5083d7 added javapath (for cygwin);
wenzelm
parents: 25434
diff changeset
    56
27908
97f8b7c0f420 refined JVM path wrappers: Isabelle environment holds Unix version of CLASSPATH, javawrapper/scalawrapper convert it back;
wenzelm
parents: 25650
diff changeset
    57
#CLASSPATH convenience
97f8b7c0f420 refined JVM path wrappers: Isabelle environment holds Unix version of CLASSPATH, javawrapper/scalawrapper convert it back;
wenzelm
parents: 25650
diff changeset
    58
function classpath () {
97f8b7c0f420 refined JVM path wrappers: Isabelle environment holds Unix version of CLASSPATH, javawrapper/scalawrapper convert it back;
wenzelm
parents: 25650
diff changeset
    59
  for X in "$@"
97f8b7c0f420 refined JVM path wrappers: Isabelle environment holds Unix version of CLASSPATH, javawrapper/scalawrapper convert it back;
wenzelm
parents: 25650
diff changeset
    60
  do
97f8b7c0f420 refined JVM path wrappers: Isabelle environment holds Unix version of CLASSPATH, javawrapper/scalawrapper convert it back;
wenzelm
parents: 25650
diff changeset
    61
    if [ -z "$CLASSPATH" ]; then
97f8b7c0f420 refined JVM path wrappers: Isabelle environment holds Unix version of CLASSPATH, javawrapper/scalawrapper convert it back;
wenzelm
parents: 25650
diff changeset
    62
      CLASSPATH="$X"
97f8b7c0f420 refined JVM path wrappers: Isabelle environment holds Unix version of CLASSPATH, javawrapper/scalawrapper convert it back;
wenzelm
parents: 25650
diff changeset
    63
    else
97f8b7c0f420 refined JVM path wrappers: Isabelle environment holds Unix version of CLASSPATH, javawrapper/scalawrapper convert it back;
wenzelm
parents: 25650
diff changeset
    64
      CLASSPATH="$CLASSPATH:$X"
97f8b7c0f420 refined JVM path wrappers: Isabelle environment holds Unix version of CLASSPATH, javawrapper/scalawrapper convert it back;
wenzelm
parents: 25650
diff changeset
    65
    fi
97f8b7c0f420 refined JVM path wrappers: Isabelle environment holds Unix version of CLASSPATH, javawrapper/scalawrapper convert it back;
wenzelm
parents: 25650
diff changeset
    66
  done
97f8b7c0f420 refined JVM path wrappers: Isabelle environment holds Unix version of CLASSPATH, javawrapper/scalawrapper convert it back;
wenzelm
parents: 25650
diff changeset
    67
}
97f8b7c0f420 refined JVM path wrappers: Isabelle environment holds Unix version of CLASSPATH, javawrapper/scalawrapper convert it back;
wenzelm
parents: 25650
diff changeset
    68
2643
a7f469c0ba59 tuned comments;
wenzelm
parents: 2621
diff changeset
    69
#get actual settings
15972
8ac3803c8f73 export ISABELLE_HOME, do not normalize;
wenzelm
parents: 15849
diff changeset
    70
source "$ISABELLE_HOME/etc/settings" || exit 2
9227
298ae5f69b18 added ISABELLE_SITE_SETTINGS_PRESENT;
wenzelm
parents: 7770
diff changeset
    71
ISABELLE_SITE_SETTINGS_PRESENT=true
9789
wenzelm
parents: 9680
diff changeset
    72
wenzelm
parents: 9680
diff changeset
    73
[ "$ISABELLE_HOME" -ef "$ISABELLE_HOME_USER" ] && \
wenzelm
parents: 9680
diff changeset
    74
  { echo >&2 "### ISABELLE_HOME and ISABELLE_HOME_USER should not be the same directory!"; }
16253
c567f9fd61a2 observe ISABELLE_IGNORE_USER_SETTINGS;
wenzelm
parents: 15972
diff changeset
    75
[ -z "$ISABELLE_IGNORE_USER_SETTINGS" -a -f "$ISABELLE_HOME_USER/etc/settings" ] && \
16293
kleing
parents: 16253
diff changeset
    76
  { source "$ISABELLE_HOME_USER/etc/settings" || exit 2; }
2299
ed9720047d53 getsettings: bash source script to augment current env.
wenzelm
parents:
diff changeset
    77
21490
2f83b11c301b added ISABELLE_IDENTIFIER;
wenzelm
parents: 21468
diff changeset
    78
#ML system identifier
6413
b2f2770ef8d9 ML_PLATFORM;
wenzelm
parents: 3185
diff changeset
    79
if [ -z "$ML_PLATFORM" ]; then
b2f2770ef8d9 ML_PLATFORM;
wenzelm
parents: 3185
diff changeset
    80
  ML_IDENTIFIER="$ML_SYSTEM"
b2f2770ef8d9 ML_PLATFORM;
wenzelm
parents: 3185
diff changeset
    81
else
b2f2770ef8d9 ML_PLATFORM;
wenzelm
parents: 3185
diff changeset
    82
  ML_IDENTIFIER="${ML_SYSTEM}_${ML_PLATFORM}"
b2f2770ef8d9 ML_PLATFORM;
wenzelm
parents: 3185
diff changeset
    83
fi
21468
c7892915ed10 add ISABELLE_VERSION to ML_IDENTIFIER, unless this is repository or build;
wenzelm
parents: 16293
diff changeset
    84
6413
b2f2770ef8d9 ML_PLATFORM;
wenzelm
parents: 3185
diff changeset
    85
ISABELLE_OUTPUT="$ISABELLE_OUTPUT/$ML_IDENTIFIER"
3118
24dae6222579 fixed ISABELLE_OUTPUT, ISABELLE_PATH (finally?);
wenzelm
parents: 2968
diff changeset
    86
2299
ed9720047d53 getsettings: bash source script to augment current env.
wenzelm
parents:
diff changeset
    87
set +o allexport
7770
0497323c1f0b ISABELLE_SETTINGS_PRESENT: avoid multiple invocation;
wenzelm
parents: 6413
diff changeset
    88
0497323c1f0b ISABELLE_SETTINGS_PRESENT: avoid multiple invocation;
wenzelm
parents: 6413
diff changeset
    89
fi