bin/isabelle
author wenzelm
Thu Mar 21 16:16:43 2019 +0100 (3 months ago)
changeset 69942 2c48be88f847
parent 66906 03a96b8c7c06
permissions -rwxr-xr-x
further robustification (amending 772bdd1ed843);
wenzelm@10555
     1
#!/usr/bin/env bash
wenzelm@2292
     2
#
wenzelm@9786
     3
# Author: Markus Wenzel, TU Muenchen
wenzelm@2308
     4
#
wenzelm@28504
     5
# Isabelle tool wrapper.
wenzelm@2292
     6
wenzelm@15843
     7
if [ -L "$0" ]; then
wenzelm@15843
     8
  TARGET="$(LC_ALL=C ls -l "$0" | sed 's/.* -> //')"
wenzelm@15967
     9
  exec "$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd "$(dirname "$TARGET")"; pwd)/$(basename "$TARGET")" "$@"
wenzelm@15843
    10
fi
wenzelm@15843
    11
wenzelm@28504
    12
wenzelm@28504
    13
## settings
wenzelm@28504
    14
wenzelm@28504
    15
PRG="$(basename "$0")"
wenzelm@28504
    16
wenzelm@28504
    17
ISABELLE_HOME="$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd ..; pwd)"
wenzelm@28504
    18
source "$ISABELLE_HOME/lib/scripts/getsettings" || exit 2
wenzelm@28504
    19
wenzelm@28504
    20
wenzelm@62829
    21
## external tool (shell script)
wenzelm@62829
    22
wenzelm@62829
    23
if [ "$#" -ge 1 -a "$1" != "-?" ]
wenzelm@62829
    24
then
wenzelm@62829
    25
  TOOL_NAME="$1"
wenzelm@2292
    26
wenzelm@62829
    27
  splitarray ":" "$ISABELLE_TOOLS"; TOOLS=("${SPLITARRAY[@]}")
wenzelm@62829
    28
  for DIR in "${TOOLS[@]}"
wenzelm@62829
    29
  do
wenzelm@62829
    30
    TOOL="$DIR/$TOOL_NAME"
wenzelm@62829
    31
    case "$TOOL" in
wenzelm@62829
    32
      *~ | *.orig) ;;
wenzelm@62829
    33
      *)
wenzelm@62829
    34
        if [ -f "$TOOL" -a -x "$TOOL" ]; then
wenzelm@62829
    35
          shift
wenzelm@62829
    36
          exec "$TOOL" "$@"
wenzelm@62829
    37
        fi
wenzelm@62829
    38
        ;;
wenzelm@62829
    39
    esac
wenzelm@62829
    40
  done
wenzelm@62829
    41
fi
wenzelm@28504
    42
wenzelm@28504
    43
wenzelm@62829
    44
## internal tool or usage (Scala)
wenzelm@28504
    45
wenzelm@62829
    46
isabelle_admin_build jars || exit $?
wenzelm@28504
    47
wenzelm@66906
    48
eval "declare -a JAVA_ARGS=($ISABELLE_TOOL_JAVA_OPTIONS)"
wenzelm@62829
    49
exec isabelle java "${JAVA_ARGS[@]}" isabelle.Isabelle_Tool "$@"