bin/isabelle_java
author wenzelm
Sat Sep 30 11:41:35 2017 +0200 (20 months ago)
changeset 66725 c37c4f0db878
parent 64035 90017a182892
child 66906 03a96b8c7c06
permissions -rwxr-xr-x
auto update;
wenzelm@63995
     1
#!/usr/bin/env bash
wenzelm@63995
     2
#
wenzelm@63995
     3
# Author: Makarius
wenzelm@63995
     4
#
wenzelm@63995
     5
# Isabelle/Java cold start -- without settings environment
wenzelm@63995
     6
wenzelm@63995
     7
if [ -L "$0" ]; then
wenzelm@63995
     8
  TARGET="$(LC_ALL=C ls -l "$0" | sed 's/.* -> //')"
wenzelm@63995
     9
  exec "$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd "$(dirname "$TARGET")"; pwd)/$(basename "$TARGET")" "$@"
wenzelm@63995
    10
fi
wenzelm@63995
    11
wenzelm@63995
    12
export ISABELLE_HOME="$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd ..; pwd)"
wenzelm@63995
    13
wenzelm@63995
    14
(
wenzelm@63995
    15
  source "$ISABELLE_HOME/lib/scripts/getsettings" || exit 2
wenzelm@63995
    16
wenzelm@64035
    17
  case "$ISABELLE_JAVA_PLATFORM" in
wenzelm@64035
    18
    x86-*)
wenzelm@64035
    19
      ISABELLE_TOOL_JAVA_OPTIONS="$ISABELLE_TOOL_JAVA_OPTIONS32"
wenzelm@64035
    20
      ;;
wenzelm@64035
    21
    x86_64-*)
wenzelm@64035
    22
      ISABELLE_TOOL_JAVA_OPTIONS="$ISABELLE_TOOL_JAVA_OPTIONS64"
wenzelm@64035
    23
      ;;
wenzelm@64035
    24
  esac
wenzelm@64035
    25
wenzelm@64035
    26
  declare -a JAVA_ARGS; eval "JAVA_ARGS=($ISABELLE_JAVA_SYSTEM_OPTIONS $ISABELLE_TOOL_JAVA_OPTIONS)"
wenzelm@63995
    27
wenzelm@63995
    28
  if [ -f "$ISABELLE_HOME/src/Tools/jEdit/dist/jedit.jar" ]; then
wenzelm@63995
    29
    classpath "$ISABELLE_HOME/src/Tools/jEdit/dist/jedit.jar"
wenzelm@63995
    30
  fi
wenzelm@63995
    31
wenzelm@63995
    32
  [ -n "$CLASSPATH" ] && classpath "$CLASSPATH"
wenzelm@63995
    33
wenzelm@63995
    34
  echo "$ISABELLE_ROOT"
wenzelm@63995
    35
  echo "$CYGWIN_ROOT"
wenzelm@63995
    36
  echo "$JAVA_HOME"
wenzelm@63995
    37
  echo "$(platform_path "$ISABELLE_CLASSPATH")"
wenzelm@63995
    38
  for ARG in "${JAVA_ARGS[@]}"; do echo "$ARG"; done
wenzelm@63995
    39
) | {
wenzelm@63995
    40
  LINE_COUNT=0
wenzelm@63995
    41
  export ISABELLE_ROOT=""
wenzelm@63995
    42
  export CYGWIN_ROOT=""
wenzelm@63995
    43
  unset JAVA_HOME
wenzelm@63995
    44
  unset ISABELLE_CLASSPATH
wenzelm@63995
    45
  unset JAVA_ARGS; declare -a JAVA_ARGS
wenzelm@63995
    46
wenzelm@63995
    47
  while { unset REPLY; read -r; test "$?" = 0 -o -n "$REPLY"; }
wenzelm@63995
    48
  do
wenzelm@63995
    49
    case "$LINE_COUNT" in
wenzelm@63995
    50
      0)
wenzelm@63995
    51
        LINE_COUNT=1
wenzelm@63995
    52
        ISABELLE_ROOT="$REPLY"
wenzelm@63995
    53
        ;;
wenzelm@63995
    54
      1)
wenzelm@63995
    55
        LINE_COUNT=2
wenzelm@63995
    56
        CYGWIN_ROOT="$REPLY"
wenzelm@63995
    57
        ;;
wenzelm@63995
    58
      2)
wenzelm@63995
    59
        LINE_COUNT=3
wenzelm@63995
    60
        JAVA_HOME="$REPLY"
wenzelm@63995
    61
        ;;
wenzelm@63995
    62
      3)
wenzelm@63995
    63
        LINE_COUNT=4
wenzelm@63995
    64
        ISABELLE_CLASSPATH="$REPLY"
wenzelm@63995
    65
        ;;
wenzelm@63995
    66
      *)
wenzelm@63995
    67
        JAVA_ARGS["${#JAVA_ARGS[@]}"]="$REPLY"
wenzelm@63995
    68
        ;;
wenzelm@63995
    69
    esac
wenzelm@63995
    70
  done
wenzelm@63995
    71
wenzelm@63995
    72
  if [ -z "$JAVA_HOME" ]; then
wenzelm@63995
    73
    echo "Unknown JAVA_HOME -- Java unavailable" >&2
wenzelm@63995
    74
    exit 127
wenzelm@63995
    75
  else
wenzelm@64022
    76
    unset ISABELLE_HOME
wenzelm@63995
    77
    unset CLASSPATH
wenzelm@63995
    78
    exec "$JAVA_HOME/bin/java" "${JAVA_ARGS[@]}" -classpath "$ISABELLE_CLASSPATH" "$@"
wenzelm@63995
    79
  fi
wenzelm@63995
    80
}