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