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