lib/scripts/getsettings
author wenzelm
Fri Aug 15 22:59:02 2008 +0200 (2008-08-15)
changeset 27908 97f8b7c0f420
parent 25650 ce061f5083d7
child 27910 6f60110e317c
permissions -rw-r--r--
refined JVM path wrappers: Isabelle environment holds Unix version of CLASSPATH, javawrapper/scalawrapper convert it back;
wenzelm@25434
     1
# -*- shell-script -*- :mode=shellscript:
wenzelm@2307
     2
# $Id$
wenzelm@9789
     3
# Author: Markus Wenzel, TU Muenchen
wenzelm@2299
     4
#
wenzelm@2348
     5
# getsettings - bash source script to augment current env.
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@15972
    14
export ISABELLE_HOME
wenzelm@12598
    15
if { echo -n "$ISABELLE_HOME" | fgrep " " >/dev/null; }
wenzelm@12598
    16
then
wenzelm@12598
    17
  echo 1>&2 "### White space in ISABELLE_HOME may cause strange problems later on!"
wenzelm@12598
    18
  echo 1>&2 "### ISABELLE_HOME=\"$ISABELLE_HOME\""
wenzelm@12598
    19
fi
wenzelm@2736
    20
wenzelm@11553
    21
#key executables
wenzelm@11553
    22
ISABELLE="$ISABELLE_HOME/bin/isabelle-process"
wenzelm@9789
    23
ISATOOL="$ISABELLE_HOME/bin/isatool"
wenzelm@2299
    24
wenzelm@25434
    25
#Isabelle distribution identifier -- filled in automatically!
wenzelm@25434
    26
ISABELLE_IDENTIFIER=""
wenzelm@21490
    27
wenzelm@2643
    28
#users tend to put strange things in here ...
wenzelm@2621
    29
unset ENV
wenzelm@2621
    30
unset BASH_ENV
wenzelm@2621
    31
wenzelm@9680
    32
#support easy settings
wenzelm@9680
    33
function choosefrom ()
wenzelm@9680
    34
{
wenzelm@9680
    35
  local RESULT=""
wenzelm@9680
    36
  local FILE=""
wenzelm@9680
    37
wenzelm@9680
    38
  for FILE in "$@"
wenzelm@9680
    39
  do
wenzelm@9680
    40
    [ -z "$RESULT" -a -e "$FILE" ] && RESULT="$FILE"
wenzelm@9680
    41
  done
wenzelm@9680
    42
wenzelm@9680
    43
  [ -z "$RESULT" ] && RESULT="$FILE"
wenzelm@9680
    44
  echo "$RESULT"
wenzelm@9680
    45
}
wenzelm@9680
    46
wenzelm@27908
    47
#JVM path wrappers
wenzelm@25650
    48
if [ "$OSTYPE" = cygwin ]; then
wenzelm@27908
    49
  CLASSPATH="$(cygpath -u -p "$CLASSPATH")"
wenzelm@27908
    50
  function jvmpath() { cygpath -w -p "$@"; }
wenzelm@27908
    51
  function javawrapper() { env CLASSPATH="$(javapath "$CLASSPATH")" java "$@"; }
wenzelm@27908
    52
  function scalawrapper() { env CLASSPATH="$(javapath "$CLASSPATH")" scala "$@"; }
wenzelm@25650
    53
else
wenzelm@27908
    54
  function jvmpath() { echo "$@"; }
wenzelm@27908
    55
  function javawrapper() { java "$@"; }
wenzelm@27908
    56
  function scalawrapper() { scala "$@"; }
wenzelm@25650
    57
fi
wenzelm@25650
    58
wenzelm@27908
    59
#CLASSPATH convenience
wenzelm@27908
    60
function classpath () {
wenzelm@27908
    61
  for X in "$@"
wenzelm@27908
    62
  do
wenzelm@27908
    63
    if [ -z "$CLASSPATH" ]; then
wenzelm@27908
    64
      CLASSPATH="$X"
wenzelm@27908
    65
    else
wenzelm@27908
    66
      CLASSPATH="$CLASSPATH:$X"
wenzelm@27908
    67
    fi
wenzelm@27908
    68
  done
wenzelm@27908
    69
}
wenzelm@27908
    70
wenzelm@2643
    71
#get actual settings
wenzelm@15972
    72
source "$ISABELLE_HOME/etc/settings" || exit 2
wenzelm@9227
    73
ISABELLE_SITE_SETTINGS_PRESENT=true
wenzelm@9789
    74
wenzelm@9789
    75
[ "$ISABELLE_HOME" -ef "$ISABELLE_HOME_USER" ] && \
wenzelm@9789
    76
  { echo >&2 "### ISABELLE_HOME and ISABELLE_HOME_USER should not be the same directory!"; }
wenzelm@16253
    77
[ -z "$ISABELLE_IGNORE_USER_SETTINGS" -a -f "$ISABELLE_HOME_USER/etc/settings" ] && \
kleing@16293
    78
  { source "$ISABELLE_HOME_USER/etc/settings" || exit 2; }
wenzelm@2299
    79
wenzelm@21490
    80
#ML system identifier
wenzelm@6413
    81
if [ -z "$ML_PLATFORM" ]; then
wenzelm@6413
    82
  ML_IDENTIFIER="$ML_SYSTEM"
wenzelm@6413
    83
else
wenzelm@6413
    84
  ML_IDENTIFIER="${ML_SYSTEM}_${ML_PLATFORM}"
wenzelm@6413
    85
fi
wenzelm@21468
    86
wenzelm@6413
    87
ISABELLE_OUTPUT="$ISABELLE_OUTPUT/$ML_IDENTIFIER"
wenzelm@3118
    88
wenzelm@2299
    89
set +o allexport
wenzelm@7770
    90
wenzelm@7770
    91
fi