lib/scripts/getsettings
author wenzelm
Thu Aug 24 00:53:53 2000 +0200 (2000-08-24)
changeset 9680 6581bfc8421e
parent 9227 298ae5f69b18
child 9789 7e5e6c47c0b5
permissions -rw-r--r--
choosefrom: support easy settings;
wenzelm@2307
     1
#
wenzelm@2307
     2
# $Id$
wenzelm@2299
     3
#
wenzelm@2348
     4
# getsettings - bash source script to augment current env.
wenzelm@2299
     5
#
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@2736
    14
#normalize ISABELLE_HOME as passed by caller
wenzelm@2736
    15
ISABELLE_HOME=$(cd $ISABELLE_HOME; echo $PWD)
wenzelm@2736
    16
wenzelm@3185
    17
#main executables
wenzelm@3185
    18
ISABELLE=$ISABELLE_HOME/bin/isabelle
wenzelm@3185
    19
ISATOOL=$ISABELLE_HOME/bin/isatool
wenzelm@2299
    20
wenzelm@2643
    21
#users tend to put strange things in here ...
wenzelm@2621
    22
unset ENV
wenzelm@2621
    23
unset BASH_ENV
wenzelm@2621
    24
wenzelm@9680
    25
#support easy settings
wenzelm@9680
    26
function choosefrom ()
wenzelm@9680
    27
{
wenzelm@9680
    28
  local RESULT=""
wenzelm@9680
    29
  local FILE=""
wenzelm@9680
    30
wenzelm@9680
    31
  for FILE in "$@"
wenzelm@9680
    32
  do
wenzelm@9680
    33
    [ -z "$RESULT" -a -e "$FILE" ] && RESULT="$FILE"
wenzelm@9680
    34
  done
wenzelm@9680
    35
wenzelm@9680
    36
  [ -z "$RESULT" ] && RESULT="$FILE"
wenzelm@9680
    37
  echo "$RESULT"
wenzelm@9680
    38
}
wenzelm@9680
    39
wenzelm@2643
    40
#get actual settings
wenzelm@2428
    41
. $ISABELLE_HOME/etc/settings || exit 2
wenzelm@9227
    42
ISABELLE_SITE_SETTINGS_PRESENT=true
wenzelm@2299
    43
[ -f $ISABELLE_HOME_USER/etc/settings ] && . $ISABELLE_HOME_USER/etc/settings
wenzelm@2299
    44
wenzelm@6413
    45
#append ML system identifier to paths
wenzelm@6413
    46
if [ -z "$ML_PLATFORM" ]; then
wenzelm@6413
    47
  ML_IDENTIFIER="$ML_SYSTEM"
wenzelm@6413
    48
else
wenzelm@6413
    49
  ML_IDENTIFIER="${ML_SYSTEM}_${ML_PLATFORM}"
wenzelm@6413
    50
fi
wenzelm@6413
    51
ISABELLE_OUTPUT="$ISABELLE_OUTPUT/$ML_IDENTIFIER"
wenzelm@6413
    52
ISABELLE_PATH=$(for DIR in $(echo $ISABELLE_PATH | tr : " "); do echo $DIR/$ML_IDENTIFIER; done)
wenzelm@3118
    53
ISABELLE_PATH=$(echo $ISABELLE_PATH | tr " " :)
wenzelm@3118
    54
wenzelm@2299
    55
set +o allexport
wenzelm@7770
    56
wenzelm@7770
    57
fi