author | wenzelm |
Mon, 04 Mar 2024 21:58:53 +0100 | |
changeset 79771 | 48af00f6f110 |
parent 76343 | 6a6f650cc5a2 |
permissions | -rwxr-xr-x |
63995 | 1 |
#!/usr/bin/env bash |
2 |
# |
|
3 |
# Author: Makarius |
|
4 |
# |
|
5 |
# Isabelle/Java cold start -- without settings environment |
|
6 |
||
73705
ac07f6be27ea
avoid unexpected output+behaviour when CDPATH is set
kleing
parents:
69126
diff
changeset
|
7 |
unset CDPATH |
ac07f6be27ea
avoid unexpected output+behaviour when CDPATH is set
kleing
parents:
69126
diff
changeset
|
8 |
|
63995 | 9 |
if [ -L "$0" ]; then |
10 |
TARGET="$(LC_ALL=C ls -l "$0" | sed 's/.* -> //')" |
|
11 |
exec "$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd "$(dirname "$TARGET")"; pwd)/$(basename "$TARGET")" "$@" |
|
12 |
fi |
|
13 |
||
14 |
export ISABELLE_HOME="$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd ..; pwd)" |
|
15 |
||
16 |
( |
|
17 |
source "$ISABELLE_HOME/lib/scripts/getsettings" || exit 2 |
|
18 |
||
66906 | 19 |
eval "declare -a JAVA_ARGS=($ISABELLE_JAVA_SYSTEM_OPTIONS $ISABELLE_TOOL_JAVA_OPTIONS)" |
63995 | 20 |
|
73988 | 21 |
classpath "$ISABELLE_SETUP_CLASSPATH" |
73989 | 22 |
classpath "$CLASSPATH" |
63995 | 23 |
|
24 |
echo "$ISABELLE_ROOT" |
|
25 |
echo "$CYGWIN_ROOT" |
|
26 |
echo "$JAVA_HOME" |
|
27 |
echo "$(platform_path "$ISABELLE_CLASSPATH")" |
|
28 |
for ARG in "${JAVA_ARGS[@]}"; do echo "$ARG"; done |
|
29 |
) | { |
|
30 |
LINE_COUNT=0 |
|
31 |
export ISABELLE_ROOT="" |
|
32 |
export CYGWIN_ROOT="" |
|
33 |
unset JAVA_HOME |
|
34 |
unset ISABELLE_CLASSPATH |
|
35 |
unset JAVA_ARGS; declare -a JAVA_ARGS |
|
36 |
||
37 |
while { unset REPLY; read -r; test "$?" = 0 -o -n "$REPLY"; } |
|
38 |
do |
|
39 |
case "$LINE_COUNT" in |
|
40 |
0) |
|
41 |
LINE_COUNT=1 |
|
42 |
ISABELLE_ROOT="$REPLY" |
|
43 |
;; |
|
44 |
1) |
|
45 |
LINE_COUNT=2 |
|
46 |
CYGWIN_ROOT="$REPLY" |
|
47 |
;; |
|
48 |
2) |
|
49 |
LINE_COUNT=3 |
|
50 |
JAVA_HOME="$REPLY" |
|
51 |
;; |
|
52 |
3) |
|
53 |
LINE_COUNT=4 |
|
54 |
ISABELLE_CLASSPATH="$REPLY" |
|
55 |
;; |
|
56 |
*) |
|
57 |
JAVA_ARGS["${#JAVA_ARGS[@]}"]="$REPLY" |
|
58 |
;; |
|
59 |
esac |
|
60 |
done |
|
61 |
||
62 |
if [ -z "$JAVA_HOME" ]; then |
|
63 |
echo "Unknown JAVA_HOME -- Java unavailable" >&2 |
|
64 |
exit 127 |
|
65 |
else |
|
64022 | 66 |
unset ISABELLE_HOME |
76343
6a6f650cc5a2
more robust reset of CLASSPATH: unset variable means "." in certain situations, e.g. scalac;
wenzelm
parents:
73989
diff
changeset
|
67 |
export CLASSPATH="" |
67490
982f0bf34804
more robust java.ext.dirs: avoid picking up accidental jars from system directories;
wenzelm
parents:
66906
diff
changeset
|
68 |
exec "$JAVA_HOME/bin/java" "${JAVA_ARGS[@]}" \ |
982f0bf34804
more robust java.ext.dirs: avoid picking up accidental jars from system directories;
wenzelm
parents:
66906
diff
changeset
|
69 |
-classpath "$ISABELLE_CLASSPATH" "$@" |
63995 | 70 |
fi |
71 |
} |