| author | wenzelm | 
| Wed, 20 Aug 2014 11:05:41 +0200 | |
| changeset 58012 | 0b0519c41229 | 
| parent 57411 | 9444489766a1 | 
| child 58413 | 22dd971f6938 | 
| permissions | -rwxr-xr-x | 
| 25434 
746677c843a7
ISABELLE_IDENTIFIER is filled in automatically, not taken from the *long* form of isatool version!
 wenzelm parents: 
21490diff
changeset | 1 | # -*- shell-script -*- :mode=shellscript: | 
| 29145 | 2 | # | 
| 9789 | 3 | # Author: Markus Wenzel, TU Muenchen | 
| 2299 
ed9720047d53
getsettings: bash source script to augment current env.
 wenzelm parents: diff
changeset | 4 | # | 
| 2348 | 5 | # getsettings - bash source script to augment current env. | 
| 2299 
ed9720047d53
getsettings: bash source script to augment current env.
 wenzelm parents: diff
changeset | 6 | |
| 7770 
0497323c1f0b
ISABELLE_SETTINGS_PRESENT: avoid multiple invocation;
 wenzelm parents: 
6413diff
changeset | 7 | if [ -z "$ISABELLE_SETTINGS_PRESENT" ] | 
| 
0497323c1f0b
ISABELLE_SETTINGS_PRESENT: avoid multiple invocation;
 wenzelm parents: 
6413diff
changeset | 8 | then | 
| 
0497323c1f0b
ISABELLE_SETTINGS_PRESENT: avoid multiple invocation;
 wenzelm parents: 
6413diff
changeset | 9 | |
| 3185 | 10 | set -o allexport | 
| 11 | ||
| 7770 
0497323c1f0b
ISABELLE_SETTINGS_PRESENT: avoid multiple invocation;
 wenzelm parents: 
6413diff
changeset | 12 | ISABELLE_SETTINGS_PRESENT=true | 
| 
0497323c1f0b
ISABELLE_SETTINGS_PRESENT: avoid multiple invocation;
 wenzelm parents: 
6413diff
changeset | 13 | |
| 53913 
5ff12177a067
prefer GNU tar for Isabelle to avoid odd extended header keywords produced by Apple's bsdtar (see also 8f6046b7f850);
 wenzelm parents: 
53580diff
changeset | 14 | #GNU tar (notably on Mac OS X) | 
| 
5ff12177a067
prefer GNU tar for Isabelle to avoid odd extended header keywords produced by Apple's bsdtar (see also 8f6046b7f850);
 wenzelm parents: 
53580diff
changeset | 15 | if [ -x /usr/bin/gnutar ]; then | 
| 
5ff12177a067
prefer GNU tar for Isabelle to avoid odd extended header keywords produced by Apple's bsdtar (see also 8f6046b7f850);
 wenzelm parents: 
53580diff
changeset | 16 |   function tar() { /usr/bin/gnutar "$@"; }
 | 
| 
5ff12177a067
prefer GNU tar for Isabelle to avoid odd extended header keywords produced by Apple's bsdtar (see also 8f6046b7f850);
 wenzelm parents: 
53580diff
changeset | 17 | fi | 
| 
5ff12177a067
prefer GNU tar for Isabelle to avoid odd extended header keywords produced by Apple's bsdtar (see also 8f6046b7f850);
 wenzelm parents: 
53580diff
changeset | 18 | |
| 57411 
9444489766a1
sane environment defaults for Mac OS X, based on former App1/script -- e.g. relevant for MacTeX PATH;
 wenzelm parents: 
56448diff
changeset | 19 | #sane environment defaults (notably on Mac OS X) | 
| 
9444489766a1
sane environment defaults for Mac OS X, based on former App1/script -- e.g. relevant for MacTeX PATH;
 wenzelm parents: 
56448diff
changeset | 20 | if [ "$ISABELLE_APP" = true -a -x /usr/libexec/path_helper ]; then | 
| 
9444489766a1
sane environment defaults for Mac OS X, based on former App1/script -- e.g. relevant for MacTeX PATH;
 wenzelm parents: 
56448diff
changeset | 21 | eval $(/usr/libexec/path_helper -s) | 
| 
9444489766a1
sane environment defaults for Mac OS X, based on former App1/script -- e.g. relevant for MacTeX PATH;
 wenzelm parents: 
56448diff
changeset | 22 | fi | 
| 
9444489766a1
sane environment defaults for Mac OS X, based on former App1/script -- e.g. relevant for MacTeX PATH;
 wenzelm parents: 
56448diff
changeset | 23 | |
| 48838 
623ba165d059
direct support for component forests via init_components;
 wenzelm parents: 
48837diff
changeset | 24 | #Cygwin vs. POSIX | 
| 47461 
5a7903ba2dac
more robust treatment of ISABELLE_HOME on windows: eliminate spaces and funny unicode characters in directory name via DOS~1 notation;
 wenzelm parents: 
47254diff
changeset | 25 | if [ "$OSTYPE" = cygwin ] | 
| 
5a7903ba2dac
more robust treatment of ISABELLE_HOME on windows: eliminate spaces and funny unicode characters in directory name via DOS~1 notation;
 wenzelm parents: 
47254diff
changeset | 26 | then | 
| 53970 | 27 | unset INI_DIR | 
| 28 | ||
| 47661 
012a887997f3
USER_HOME settings variable points to cross-platform user home directory;
 wenzelm parents: 
47525diff
changeset | 29 | if [ -z "$USER_HOME" ]; then | 
| 
012a887997f3
USER_HOME settings variable points to cross-platform user home directory;
 wenzelm parents: 
47525diff
changeset | 30 | USER_HOME="$(cygpath -u "$HOMEDRIVE\\$HOMEPATH")" | 
| 
012a887997f3
USER_HOME settings variable points to cross-platform user home directory;
 wenzelm parents: 
47525diff
changeset | 31 | fi | 
| 
012a887997f3
USER_HOME settings variable points to cross-platform user home directory;
 wenzelm parents: 
47525diff
changeset | 32 | |
| 47461 
5a7903ba2dac
more robust treatment of ISABELLE_HOME on windows: eliminate spaces and funny unicode characters in directory name via DOS~1 notation;
 wenzelm parents: 
47254diff
changeset | 33 |   function jvmpath() { cygpath -i -C UTF8 -w -p "$@"; }
 | 
| 47996 
25b9f59ab1b9
simplified Cygwin root: warm start via env, cold start via property, no registry magic;
 wenzelm parents: 
47748diff
changeset | 34 | CYGWIN_ROOT="$(jvmpath "/")" | 
| 53576 
793a429c63e7
maintain classpath in more elementary manner: turn ISABELLE_CLASSPATH into -classpath option, so that all jars are covered by sun.misc.Launcher.AppClassLoader (e.g. relevant for loading add-on resources);
 wenzelm parents: 
52443diff
changeset | 35 | |
| 
793a429c63e7
maintain classpath in more elementary manner: turn ISABELLE_CLASSPATH into -classpath option, so that all jars are covered by sun.misc.Launcher.AppClassLoader (e.g. relevant for loading add-on resources);
 wenzelm parents: 
52443diff
changeset | 36 | ISABELLE_CLASSPATH="$(cygpath -i -u -p "$CLASSPATH")" | 
| 
793a429c63e7
maintain classpath in more elementary manner: turn ISABELLE_CLASSPATH into -classpath option, so that all jars are covered by sun.misc.Launcher.AppClassLoader (e.g. relevant for loading add-on resources);
 wenzelm parents: 
52443diff
changeset | 37 | unset CLASSPATH | 
| 47461 
5a7903ba2dac
more robust treatment of ISABELLE_HOME on windows: eliminate spaces and funny unicode characters in directory name via DOS~1 notation;
 wenzelm parents: 
47254diff
changeset | 38 | else | 
| 47661 
012a887997f3
USER_HOME settings variable points to cross-platform user home directory;
 wenzelm parents: 
47525diff
changeset | 39 | if [ -z "$USER_HOME" ]; then | 
| 
012a887997f3
USER_HOME settings variable points to cross-platform user home directory;
 wenzelm parents: 
47525diff
changeset | 40 | USER_HOME="$HOME" | 
| 
012a887997f3
USER_HOME settings variable points to cross-platform user home directory;
 wenzelm parents: 
47525diff
changeset | 41 | fi | 
| 
012a887997f3
USER_HOME settings variable points to cross-platform user home directory;
 wenzelm parents: 
47525diff
changeset | 42 | |
| 47461 
5a7903ba2dac
more robust treatment of ISABELLE_HOME on windows: eliminate spaces and funny unicode characters in directory name via DOS~1 notation;
 wenzelm parents: 
47254diff
changeset | 43 |   function jvmpath() { echo "$@"; }
 | 
| 53576 
793a429c63e7
maintain classpath in more elementary manner: turn ISABELLE_CLASSPATH into -classpath option, so that all jars are covered by sun.misc.Launcher.AppClassLoader (e.g. relevant for loading add-on resources);
 wenzelm parents: 
52443diff
changeset | 44 | |
| 
793a429c63e7
maintain classpath in more elementary manner: turn ISABELLE_CLASSPATH into -classpath option, so that all jars are covered by sun.misc.Launcher.AppClassLoader (e.g. relevant for loading add-on resources);
 wenzelm parents: 
52443diff
changeset | 45 | ISABELLE_CLASSPATH="$CLASSPATH" | 
| 
793a429c63e7
maintain classpath in more elementary manner: turn ISABELLE_CLASSPATH into -classpath option, so that all jars are covered by sun.misc.Launcher.AppClassLoader (e.g. relevant for loading add-on resources);
 wenzelm parents: 
52443diff
changeset | 46 | unset CLASSPATH | 
| 47461 
5a7903ba2dac
more robust treatment of ISABELLE_HOME on windows: eliminate spaces and funny unicode characters in directory name via DOS~1 notation;
 wenzelm parents: 
47254diff
changeset | 47 | fi | 
| 
5a7903ba2dac
more robust treatment of ISABELLE_HOME on windows: eliminate spaces and funny unicode characters in directory name via DOS~1 notation;
 wenzelm parents: 
47254diff
changeset | 48 | |
| 15972 | 49 | export ISABELLE_HOME | 
| 2736 | 50 | |
| 11553 | 51 | #key executables | 
| 56440 | 52 | ISABELLE_TOOL="$ISABELLE_HOME/bin/isabelle" | 
| 56439 
95e2656b3b23
renamed "isabelle-process" to "isabelle_process", with shell function to avoid dynamic path lookups;
 wenzelm parents: 
53970diff
changeset | 53 | ISABELLE_PROCESS="$ISABELLE_HOME/bin/isabelle_process" | 
| 56448 
344800503974
provide old-style ISABELLE_SCALA_SCRIPT for uniformity;
 wenzelm parents: 
56440diff
changeset | 54 | ISABELLE_SCALA_SCRIPT="$ISABELLE_HOME/bin/isabelle_scala_script" | 
| 56440 | 55 | |
| 56 | function isabelle () | |
| 57 | {
 | |
| 58 | "$ISABELLE_TOOL" "$@" | |
| 59 | } | |
| 2299 
ed9720047d53
getsettings: bash source script to augment current env.
 wenzelm parents: diff
changeset | 60 | |
| 56439 
95e2656b3b23
renamed "isabelle-process" to "isabelle_process", with shell function to avoid dynamic path lookups;
 wenzelm parents: 
53970diff
changeset | 61 | function isabelle_process () | 
| 
95e2656b3b23
renamed "isabelle-process" to "isabelle_process", with shell function to avoid dynamic path lookups;
 wenzelm parents: 
53970diff
changeset | 62 | {
 | 
| 
95e2656b3b23
renamed "isabelle-process" to "isabelle_process", with shell function to avoid dynamic path lookups;
 wenzelm parents: 
53970diff
changeset | 63 | "$ISABELLE_PROCESS" "$@" | 
| 
95e2656b3b23
renamed "isabelle-process" to "isabelle_process", with shell function to avoid dynamic path lookups;
 wenzelm parents: 
53970diff
changeset | 64 | } | 
| 
95e2656b3b23
renamed "isabelle-process" to "isabelle_process", with shell function to avoid dynamic path lookups;
 wenzelm parents: 
53970diff
changeset | 65 | |
| 56440 | 66 | function isabelle_scala_script () | 
| 34254 
14f6df4f473d
shell functions "isabelle-process" and "isabelle" refer to the proper executables statically -- for interactive use or sloppy bash scripts;
 wenzelm parents: 
34043diff
changeset | 67 | {
 | 
| 56448 
344800503974
provide old-style ISABELLE_SCALA_SCRIPT for uniformity;
 wenzelm parents: 
56440diff
changeset | 68 | "$ISABELLE_SCALA_SCRIPT" "$@" | 
| 34254 
14f6df4f473d
shell functions "isabelle-process" and "isabelle" refer to the proper executables statically -- for interactive use or sloppy bash scripts;
 wenzelm parents: 
34043diff
changeset | 69 | } | 
| 
14f6df4f473d
shell functions "isabelle-process" and "isabelle" refer to the proper executables statically -- for interactive use or sloppy bash scripts;
 wenzelm parents: 
34043diff
changeset | 70 | |
| 36196 
cbb9ee265cdd
added ISABELLE_PLATFORM and ISABELLE_PLATFORM64 -- NB: ML and JVM may have a different idea;
 wenzelm parents: 
36194diff
changeset | 71 | #platform | 
| 41758 | 72 | source "$ISABELLE_HOME/lib/scripts/isabelle-platform" | 
| 48455 | 73 | if [ -z "$ISABELLE_PLATFORM" ]; then | 
| 74 | echo 1>&2 "Failed to determine hardware and operating system type!" | |
| 75 | exit 2 | |
| 76 | fi | |
| 36196 
cbb9ee265cdd
added ISABELLE_PLATFORM and ISABELLE_PLATFORM64 -- NB: ML and JVM may have a different idea;
 wenzelm parents: 
36194diff
changeset | 77 | |
| 25434 
746677c843a7
ISABELLE_IDENTIFIER is filled in automatically, not taken from the *long* form of isatool version!
 wenzelm parents: 
21490diff
changeset | 78 | #Isabelle distribution identifier -- filled in automatically! | 
| 41511 | 79 | ISABELLE_ID="" | 
| 48837 
d1d806a42c91
allow to provide external ISABELLE_IDENTIFIER for repository clone -- potentially relevant for isatest and mira;
 wenzelm parents: 
48790diff
changeset | 80 | [ -z "$ISABELLE_IDENTIFIER" ] && ISABELLE_IDENTIFIER="" | 
| 21490 | 81 | |
| 41511 | 82 | #sometimes users put strange things in here ... | 
| 2621 | 83 | unset ENV | 
| 84 | unset BASH_ENV | |
| 85 | ||
| 41614 
b7cd80330a16
added librarypath: shared library convenience in bash, keeping LD_LIBRARY_PATH and DYLD_LIBRARY_PATH separate;
 wenzelm parents: 
41511diff
changeset | 86 | #shared library convenience | 
| 52443 | 87 | function librarypath () | 
| 88 | {
 | |
| 41614 
b7cd80330a16
added librarypath: shared library convenience in bash, keeping LD_LIBRARY_PATH and DYLD_LIBRARY_PATH separate;
 wenzelm parents: 
41511diff
changeset | 89 | for X in "$@" | 
| 
b7cd80330a16
added librarypath: shared library convenience in bash, keeping LD_LIBRARY_PATH and DYLD_LIBRARY_PATH separate;
 wenzelm parents: 
41511diff
changeset | 90 | do | 
| 
b7cd80330a16
added librarypath: shared library convenience in bash, keeping LD_LIBRARY_PATH and DYLD_LIBRARY_PATH separate;
 wenzelm parents: 
41511diff
changeset | 91 | case "$ISABELLE_PLATFORM" in | 
| 
b7cd80330a16
added librarypath: shared library convenience in bash, keeping LD_LIBRARY_PATH and DYLD_LIBRARY_PATH separate;
 wenzelm parents: 
41511diff
changeset | 92 | *-darwin) | 
| 
b7cd80330a16
added librarypath: shared library convenience in bash, keeping LD_LIBRARY_PATH and DYLD_LIBRARY_PATH separate;
 wenzelm parents: 
41511diff
changeset | 93 | if [ -z "$DYLD_LIBRARY_PATH" ]; then | 
| 
b7cd80330a16
added librarypath: shared library convenience in bash, keeping LD_LIBRARY_PATH and DYLD_LIBRARY_PATH separate;
 wenzelm parents: 
41511diff
changeset | 94 | DYLD_LIBRARY_PATH="$X" | 
| 
b7cd80330a16
added librarypath: shared library convenience in bash, keeping LD_LIBRARY_PATH and DYLD_LIBRARY_PATH separate;
 wenzelm parents: 
41511diff
changeset | 95 | else | 
| 
b7cd80330a16
added librarypath: shared library convenience in bash, keeping LD_LIBRARY_PATH and DYLD_LIBRARY_PATH separate;
 wenzelm parents: 
41511diff
changeset | 96 | DYLD_LIBRARY_PATH="$X:$DYLD_LIBRARY_PATH" | 
| 
b7cd80330a16
added librarypath: shared library convenience in bash, keeping LD_LIBRARY_PATH and DYLD_LIBRARY_PATH separate;
 wenzelm parents: 
41511diff
changeset | 97 | fi | 
| 
b7cd80330a16
added librarypath: shared library convenience in bash, keeping LD_LIBRARY_PATH and DYLD_LIBRARY_PATH separate;
 wenzelm parents: 
41511diff
changeset | 98 | export DYLD_LIBRARY_PATH | 
| 
b7cd80330a16
added librarypath: shared library convenience in bash, keeping LD_LIBRARY_PATH and DYLD_LIBRARY_PATH separate;
 wenzelm parents: 
41511diff
changeset | 99 | ;; | 
| 
b7cd80330a16
added librarypath: shared library convenience in bash, keeping LD_LIBRARY_PATH and DYLD_LIBRARY_PATH separate;
 wenzelm parents: 
41511diff
changeset | 100 | *) | 
| 
b7cd80330a16
added librarypath: shared library convenience in bash, keeping LD_LIBRARY_PATH and DYLD_LIBRARY_PATH separate;
 wenzelm parents: 
41511diff
changeset | 101 | if [ -z "$LD_LIBRARY_PATH" ]; then | 
| 
b7cd80330a16
added librarypath: shared library convenience in bash, keeping LD_LIBRARY_PATH and DYLD_LIBRARY_PATH separate;
 wenzelm parents: 
41511diff
changeset | 102 | LD_LIBRARY_PATH="$X" | 
| 
b7cd80330a16
added librarypath: shared library convenience in bash, keeping LD_LIBRARY_PATH and DYLD_LIBRARY_PATH separate;
 wenzelm parents: 
41511diff
changeset | 103 | else | 
| 
b7cd80330a16
added librarypath: shared library convenience in bash, keeping LD_LIBRARY_PATH and DYLD_LIBRARY_PATH separate;
 wenzelm parents: 
41511diff
changeset | 104 | LD_LIBRARY_PATH="$X:$LD_LIBRARY_PATH" | 
| 
b7cd80330a16
added librarypath: shared library convenience in bash, keeping LD_LIBRARY_PATH and DYLD_LIBRARY_PATH separate;
 wenzelm parents: 
41511diff
changeset | 105 | fi | 
| 
b7cd80330a16
added librarypath: shared library convenience in bash, keeping LD_LIBRARY_PATH and DYLD_LIBRARY_PATH separate;
 wenzelm parents: 
41511diff
changeset | 106 | export LD_LIBRARY_PATH | 
| 
b7cd80330a16
added librarypath: shared library convenience in bash, keeping LD_LIBRARY_PATH and DYLD_LIBRARY_PATH separate;
 wenzelm parents: 
41511diff
changeset | 107 | ;; | 
| 
b7cd80330a16
added librarypath: shared library convenience in bash, keeping LD_LIBRARY_PATH and DYLD_LIBRARY_PATH separate;
 wenzelm parents: 
41511diff
changeset | 108 | esac | 
| 
b7cd80330a16
added librarypath: shared library convenience in bash, keeping LD_LIBRARY_PATH and DYLD_LIBRARY_PATH separate;
 wenzelm parents: 
41511diff
changeset | 109 | done | 
| 
b7cd80330a16
added librarypath: shared library convenience in bash, keeping LD_LIBRARY_PATH and DYLD_LIBRARY_PATH separate;
 wenzelm parents: 
41511diff
changeset | 110 | } | 
| 
b7cd80330a16
added librarypath: shared library convenience in bash, keeping LD_LIBRARY_PATH and DYLD_LIBRARY_PATH separate;
 wenzelm parents: 
41511diff
changeset | 111 | |
| 47115 
1a05adae1cc9
more robust command invocation via ISABELLE_JDK_HOME or SCALA_HOME (NB: bash exec requires genuine executable, not function);
 wenzelm parents: 
46741diff
changeset | 112 | #robust invocation via ISABELLE_JDK_HOME | 
| 52443 | 113 | function isabelle_jdk () | 
| 114 | {
 | |
| 47465 
71d5f37ee2bf
more robust invocation via ISABELLE_JDK_HOME and SCALA_HOME;
 wenzelm parents: 
47461diff
changeset | 115 | if [ -z "$ISABELLE_JDK_HOME" ]; then | 
| 
71d5f37ee2bf
more robust invocation via ISABELLE_JDK_HOME and SCALA_HOME;
 wenzelm parents: 
47461diff
changeset | 116 | echo "Unknown ISABELLE_JDK_HOME -- Java tools unavailable" >&2 | 
| 47490 
f4348634595b
more precise handling of java failure, due to missing ISABELLE_JDK_HOME;
 wenzelm parents: 
47465diff
changeset | 117 | return 127 | 
| 47465 
71d5f37ee2bf
more robust invocation via ISABELLE_JDK_HOME and SCALA_HOME;
 wenzelm parents: 
47461diff
changeset | 118 | else | 
| 
71d5f37ee2bf
more robust invocation via ISABELLE_JDK_HOME and SCALA_HOME;
 wenzelm parents: 
47461diff
changeset | 119 | local PRG="$1"; shift | 
| 
71d5f37ee2bf
more robust invocation via ISABELLE_JDK_HOME and SCALA_HOME;
 wenzelm parents: 
47461diff
changeset | 120 | "$ISABELLE_JDK_HOME/bin/$PRG" "$@" | 
| 
71d5f37ee2bf
more robust invocation via ISABELLE_JDK_HOME and SCALA_HOME;
 wenzelm parents: 
47461diff
changeset | 121 | fi | 
| 47115 
1a05adae1cc9
more robust command invocation via ISABELLE_JDK_HOME or SCALA_HOME (NB: bash exec requires genuine executable, not function);
 wenzelm parents: 
46741diff
changeset | 122 | } | 
| 
1a05adae1cc9
more robust command invocation via ISABELLE_JDK_HOME or SCALA_HOME (NB: bash exec requires genuine executable, not function);
 wenzelm parents: 
46741diff
changeset | 123 | |
| 
1a05adae1cc9
more robust command invocation via ISABELLE_JDK_HOME or SCALA_HOME (NB: bash exec requires genuine executable, not function);
 wenzelm parents: 
46741diff
changeset | 124 | #robust invocation via SCALA_HOME | 
| 52443 | 125 | function isabelle_scala () | 
| 126 | {
 | |
| 47465 
71d5f37ee2bf
more robust invocation via ISABELLE_JDK_HOME and SCALA_HOME;
 wenzelm parents: 
47461diff
changeset | 127 | if [ -z "$ISABELLE_JDK_HOME" ]; then | 
| 
71d5f37ee2bf
more robust invocation via ISABELLE_JDK_HOME and SCALA_HOME;
 wenzelm parents: 
47461diff
changeset | 128 | echo "Unknown ISABELLE_JDK_HOME -- Java tools unavailable" >&2 | 
| 47490 
f4348634595b
more precise handling of java failure, due to missing ISABELLE_JDK_HOME;
 wenzelm parents: 
47465diff
changeset | 129 | return 127 | 
| 47465 
71d5f37ee2bf
more robust invocation via ISABELLE_JDK_HOME and SCALA_HOME;
 wenzelm parents: 
47461diff
changeset | 130 | elif [ -z "$SCALA_HOME" ]; then | 
| 
71d5f37ee2bf
more robust invocation via ISABELLE_JDK_HOME and SCALA_HOME;
 wenzelm parents: 
47461diff
changeset | 131 | echo "Unknown SCALA_HOME -- Scala unavailable" >&2 | 
| 47490 
f4348634595b
more precise handling of java failure, due to missing ISABELLE_JDK_HOME;
 wenzelm parents: 
47465diff
changeset | 132 | return 127 | 
| 47465 
71d5f37ee2bf
more robust invocation via ISABELLE_JDK_HOME and SCALA_HOME;
 wenzelm parents: 
47461diff
changeset | 133 | else | 
| 
71d5f37ee2bf
more robust invocation via ISABELLE_JDK_HOME and SCALA_HOME;
 wenzelm parents: 
47461diff
changeset | 134 | local PRG="$1"; shift | 
| 
71d5f37ee2bf
more robust invocation via ISABELLE_JDK_HOME and SCALA_HOME;
 wenzelm parents: 
47461diff
changeset | 135 | "$SCALA_HOME/bin/$PRG" "$@" | 
| 
71d5f37ee2bf
more robust invocation via ISABELLE_JDK_HOME and SCALA_HOME;
 wenzelm parents: 
47461diff
changeset | 136 | fi | 
| 47115 
1a05adae1cc9
more robust command invocation via ISABELLE_JDK_HOME or SCALA_HOME (NB: bash exec requires genuine executable, not function);
 wenzelm parents: 
46741diff
changeset | 137 | } | 
| 
1a05adae1cc9
more robust command invocation via ISABELLE_JDK_HOME or SCALA_HOME (NB: bash exec requires genuine executable, not function);
 wenzelm parents: 
46741diff
changeset | 138 | |
| 52443 | 139 | #administrative build | 
| 140 | if [ -e "$ISABELLE_HOME/Admin/build" ]; then | |
| 141 | function isabelle_admin_build () | |
| 142 |   {
 | |
| 143 | "$ISABELLE_HOME/Admin/build" "$@" | |
| 144 | } | |
| 145 | else | |
| 146 |   function isabelle_admin_build () { return 0; }
 | |
| 147 | fi | |
| 148 | ||
| 53576 
793a429c63e7
maintain classpath in more elementary manner: turn ISABELLE_CLASSPATH into -classpath option, so that all jars are covered by sun.misc.Launcher.AppClassLoader (e.g. relevant for loading add-on resources);
 wenzelm parents: 
52443diff
changeset | 149 | #classpath | 
| 52443 | 150 | function classpath () | 
| 151 | {
 | |
| 27908 
97f8b7c0f420
refined JVM path wrappers: Isabelle environment holds Unix version of CLASSPATH, javawrapper/scalawrapper convert it back;
 wenzelm parents: 
25650diff
changeset | 152 | for X in "$@" | 
| 
97f8b7c0f420
refined JVM path wrappers: Isabelle environment holds Unix version of CLASSPATH, javawrapper/scalawrapper convert it back;
 wenzelm parents: 
25650diff
changeset | 153 | do | 
| 53576 
793a429c63e7
maintain classpath in more elementary manner: turn ISABELLE_CLASSPATH into -classpath option, so that all jars are covered by sun.misc.Launcher.AppClassLoader (e.g. relevant for loading add-on resources);
 wenzelm parents: 
52443diff
changeset | 154 | if [ -z "$ISABELLE_CLASSPATH" ]; then | 
| 
793a429c63e7
maintain classpath in more elementary manner: turn ISABELLE_CLASSPATH into -classpath option, so that all jars are covered by sun.misc.Launcher.AppClassLoader (e.g. relevant for loading add-on resources);
 wenzelm parents: 
52443diff
changeset | 155 | ISABELLE_CLASSPATH="$X" | 
| 27908 
97f8b7c0f420
refined JVM path wrappers: Isabelle environment holds Unix version of CLASSPATH, javawrapper/scalawrapper convert it back;
 wenzelm parents: 
25650diff
changeset | 156 | else | 
| 53580 | 157 | ISABELLE_CLASSPATH="$ISABELLE_CLASSPATH:$X" | 
| 27908 
97f8b7c0f420
refined JVM path wrappers: Isabelle environment holds Unix version of CLASSPATH, javawrapper/scalawrapper convert it back;
 wenzelm parents: 
25650diff
changeset | 158 | fi | 
| 
97f8b7c0f420
refined JVM path wrappers: Isabelle environment holds Unix version of CLASSPATH, javawrapper/scalawrapper convert it back;
 wenzelm parents: 
25650diff
changeset | 159 | done | 
| 53576 
793a429c63e7
maintain classpath in more elementary manner: turn ISABELLE_CLASSPATH into -classpath option, so that all jars are covered by sun.misc.Launcher.AppClassLoader (e.g. relevant for loading add-on resources);
 wenzelm parents: 
52443diff
changeset | 160 | export ISABELLE_CLASSPATH | 
| 27908 
97f8b7c0f420
refined JVM path wrappers: Isabelle environment holds Unix version of CLASSPATH, javawrapper/scalawrapper convert it back;
 wenzelm parents: 
25650diff
changeset | 161 | } | 
| 
97f8b7c0f420
refined JVM path wrappers: Isabelle environment holds Unix version of CLASSPATH, javawrapper/scalawrapper convert it back;
 wenzelm parents: 
25650diff
changeset | 162 | |
| 32390 
468eff174a77
function splitarray: splightly more abstract version that accomodates older bashes;
 wenzelm parents: 
32321diff
changeset | 163 | #arrays | 
| 
468eff174a77
function splitarray: splightly more abstract version that accomodates older bashes;
 wenzelm parents: 
32321diff
changeset | 164 | function splitarray () | 
| 
468eff174a77
function splitarray: splightly more abstract version that accomodates older bashes;
 wenzelm parents: 
32321diff
changeset | 165 | {
 | 
| 
468eff174a77
function splitarray: splightly more abstract version that accomodates older bashes;
 wenzelm parents: 
32321diff
changeset | 166 | SPLITARRAY=() | 
| 
468eff174a77
function splitarray: splightly more abstract version that accomodates older bashes;
 wenzelm parents: 
32321diff
changeset | 167 | local IFS="$1"; shift | 
| 
468eff174a77
function splitarray: splightly more abstract version that accomodates older bashes;
 wenzelm parents: 
32321diff
changeset | 168 | for X in $* | 
| 
468eff174a77
function splitarray: splightly more abstract version that accomodates older bashes;
 wenzelm parents: 
32321diff
changeset | 169 | do | 
| 
468eff174a77
function splitarray: splightly more abstract version that accomodates older bashes;
 wenzelm parents: 
32321diff
changeset | 170 |     SPLITARRAY["${#SPLITARRAY[@]}"]="$X"
 | 
| 
468eff174a77
function splitarray: splightly more abstract version that accomodates older bashes;
 wenzelm parents: 
32321diff
changeset | 171 | done | 
| 
468eff174a77
function splitarray: splightly more abstract version that accomodates older bashes;
 wenzelm parents: 
32321diff
changeset | 172 | } | 
| 
468eff174a77
function splitarray: splightly more abstract version that accomodates older bashes;
 wenzelm parents: 
32321diff
changeset | 173 | |
| 48838 
623ba165d059
direct support for component forests via init_components;
 wenzelm parents: 
48837diff
changeset | 174 | |
| 
623ba165d059
direct support for component forests via init_components;
 wenzelm parents: 
48837diff
changeset | 175 | # components | 
| 
623ba165d059
direct support for component forests via init_components;
 wenzelm parents: 
48837diff
changeset | 176 | |
| 32305 
c5523ded51d9
basic support for components (which imitate the usual Isabelle directory layout);
 wenzelm parents: 
31520diff
changeset | 177 | ISABELLE_COMPONENTS="" | 
| 48838 
623ba165d059
direct support for component forests via init_components;
 wenzelm parents: 
48837diff
changeset | 178 | ISABELLE_COMPONENTS_MISSING="" | 
| 
623ba165d059
direct support for component forests via init_components;
 wenzelm parents: 
48837diff
changeset | 179 | |
| 
623ba165d059
direct support for component forests via init_components;
 wenzelm parents: 
48837diff
changeset | 180 | #init component tree | 
| 32305 
c5523ded51d9
basic support for components (which imitate the usual Isabelle directory layout);
 wenzelm parents: 
31520diff
changeset | 181 | function init_component () | 
| 
c5523ded51d9
basic support for components (which imitate the usual Isabelle directory layout);
 wenzelm parents: 
31520diff
changeset | 182 | {
 | 
| 
c5523ded51d9
basic support for components (which imitate the usual Isabelle directory layout);
 wenzelm parents: 
31520diff
changeset | 183 | local COMPONENT="$1" | 
| 40570 
bf8f92bdf630
init_component: require absolute path (when invoked by user scripts);
 wenzelm parents: 
40568diff
changeset | 184 | case "$COMPONENT" in | 
| 
bf8f92bdf630
init_component: require absolute path (when invoked by user scripts);
 wenzelm parents: 
40568diff
changeset | 185 | /*) ;; | 
| 
bf8f92bdf630
init_component: require absolute path (when invoked by user scripts);
 wenzelm parents: 
40568diff
changeset | 186 | *) | 
| 
bf8f92bdf630
init_component: require absolute path (when invoked by user scripts);
 wenzelm parents: 
40568diff
changeset | 187 | echo >&2 "Absolute component path required: \"$COMPONENT\"" | 
| 
bf8f92bdf630
init_component: require absolute path (when invoked by user scripts);
 wenzelm parents: 
40568diff
changeset | 188 | exit 2 | 
| 
bf8f92bdf630
init_component: require absolute path (when invoked by user scripts);
 wenzelm parents: 
40568diff
changeset | 189 | ;; | 
| 
bf8f92bdf630
init_component: require absolute path (when invoked by user scripts);
 wenzelm parents: 
40568diff
changeset | 190 | esac | 
| 32305 
c5523ded51d9
basic support for components (which imitate the usual Isabelle directory layout);
 wenzelm parents: 
31520diff
changeset | 191 | |
| 48838 
623ba165d059
direct support for component forests via init_components;
 wenzelm parents: 
48837diff
changeset | 192 | if [ -d "$COMPONENT" ]; then | 
| 
623ba165d059
direct support for component forests via init_components;
 wenzelm parents: 
48837diff
changeset | 193 | if [ -z "$ISABELLE_COMPONENTS" ]; then | 
| 
623ba165d059
direct support for component forests via init_components;
 wenzelm parents: 
48837diff
changeset | 194 | ISABELLE_COMPONENTS="$COMPONENT" | 
| 
623ba165d059
direct support for component forests via init_components;
 wenzelm parents: 
48837diff
changeset | 195 | else | 
| 
623ba165d059
direct support for component forests via init_components;
 wenzelm parents: 
48837diff
changeset | 196 | ISABELLE_COMPONENTS="$ISABELLE_COMPONENTS:$COMPONENT" | 
| 
623ba165d059
direct support for component forests via init_components;
 wenzelm parents: 
48837diff
changeset | 197 | fi | 
| 
623ba165d059
direct support for component forests via init_components;
 wenzelm parents: 
48837diff
changeset | 198 | else | 
| 48448 | 199 | echo >&2 "### Missing Isabelle component: \"$COMPONENT\"" | 
| 48838 
623ba165d059
direct support for component forests via init_components;
 wenzelm parents: 
48837diff
changeset | 200 | if [ -z "$ISABELLE_COMPONENTS_MISSING" ]; then | 
| 
623ba165d059
direct support for component forests via init_components;
 wenzelm parents: 
48837diff
changeset | 201 | ISABELLE_COMPONENTS_MISSING="$COMPONENT" | 
| 
623ba165d059
direct support for component forests via init_components;
 wenzelm parents: 
48837diff
changeset | 202 | else | 
| 
623ba165d059
direct support for component forests via init_components;
 wenzelm parents: 
48837diff
changeset | 203 | ISABELLE_COMPONENTS_MISSING="$ISABELLE_COMPONENTS_MISSING:$COMPONENT" | 
| 
623ba165d059
direct support for component forests via init_components;
 wenzelm parents: 
48837diff
changeset | 204 | fi | 
| 32305 
c5523ded51d9
basic support for components (which imitate the usual Isabelle directory layout);
 wenzelm parents: 
31520diff
changeset | 205 | fi | 
| 48838 
623ba165d059
direct support for component forests via init_components;
 wenzelm parents: 
48837diff
changeset | 206 | |
| 32305 
c5523ded51d9
basic support for components (which imitate the usual Isabelle directory layout);
 wenzelm parents: 
31520diff
changeset | 207 | if [ -f "$COMPONENT/etc/settings" ]; then | 
| 41760 
bf49b7a85936
more explicit exit due to failed etc/settings -- normally return code 0=true and 1=false could be tolerated, but bash syntax errors also return 1;
 wenzelm parents: 
41759diff
changeset | 208 | source "$COMPONENT/etc/settings" | 
| 
bf49b7a85936
more explicit exit due to failed etc/settings -- normally return code 0=true and 1=false could be tolerated, but bash syntax errors also return 1;
 wenzelm parents: 
41759diff
changeset | 209 | local RC="$?" | 
| 
bf49b7a85936
more explicit exit due to failed etc/settings -- normally return code 0=true and 1=false could be tolerated, but bash syntax errors also return 1;
 wenzelm parents: 
41759diff
changeset | 210 | if [ "$RC" -ne 0 ]; then | 
| 
bf49b7a85936
more explicit exit due to failed etc/settings -- normally return code 0=true and 1=false could be tolerated, but bash syntax errors also return 1;
 wenzelm parents: 
41759diff
changeset | 211 | echo >&2 "Return code $RC from bash script: \"$COMPONENT/etc/settings\"" | 
| 
bf49b7a85936
more explicit exit due to failed etc/settings -- normally return code 0=true and 1=false could be tolerated, but bash syntax errors also return 1;
 wenzelm parents: 
41759diff
changeset | 212 | exit 2 | 
| 
bf49b7a85936
more explicit exit due to failed etc/settings -- normally return code 0=true and 1=false could be tolerated, but bash syntax errors also return 1;
 wenzelm parents: 
41759diff
changeset | 213 | fi | 
| 32305 
c5523ded51d9
basic support for components (which imitate the usual Isabelle directory layout);
 wenzelm parents: 
31520diff
changeset | 214 | fi | 
| 
c5523ded51d9
basic support for components (which imitate the usual Isabelle directory layout);
 wenzelm parents: 
31520diff
changeset | 215 | if [ -f "$COMPONENT/etc/components" ]; then | 
| 48838 
623ba165d059
direct support for component forests via init_components;
 wenzelm parents: 
48837diff
changeset | 216 | init_components "$COMPONENT" "$COMPONENT/etc/components" | 
| 
623ba165d059
direct support for component forests via init_components;
 wenzelm parents: 
48837diff
changeset | 217 | fi | 
| 
623ba165d059
direct support for component forests via init_components;
 wenzelm parents: 
48837diff
changeset | 218 | } | 
| 
623ba165d059
direct support for component forests via init_components;
 wenzelm parents: 
48837diff
changeset | 219 | |
| 
623ba165d059
direct support for component forests via init_components;
 wenzelm parents: 
48837diff
changeset | 220 | #init component forest | 
| 
623ba165d059
direct support for component forests via init_components;
 wenzelm parents: 
48837diff
changeset | 221 | function init_components () | 
| 
623ba165d059
direct support for component forests via init_components;
 wenzelm parents: 
48837diff
changeset | 222 | {
 | 
| 
623ba165d059
direct support for component forests via init_components;
 wenzelm parents: 
48837diff
changeset | 223 | local BASE="$1" | 
| 
623ba165d059
direct support for component forests via init_components;
 wenzelm parents: 
48837diff
changeset | 224 | local CATALOG="$2" | 
| 
623ba165d059
direct support for component forests via init_components;
 wenzelm parents: 
48837diff
changeset | 225 | |
| 
623ba165d059
direct support for component forests via init_components;
 wenzelm parents: 
48837diff
changeset | 226 | if [ ! -f "$CATALOG" ]; then | 
| 
623ba165d059
direct support for component forests via init_components;
 wenzelm parents: 
48837diff
changeset | 227 | echo >&2 "Bad component catalog file: \"$CATALOG\"" | 
| 
623ba165d059
direct support for component forests via init_components;
 wenzelm parents: 
48837diff
changeset | 228 | exit 2 | 
| 
623ba165d059
direct support for component forests via init_components;
 wenzelm parents: 
48837diff
changeset | 229 | fi | 
| 
623ba165d059
direct support for component forests via init_components;
 wenzelm parents: 
48837diff
changeset | 230 |   {
 | 
| 
623ba165d059
direct support for component forests via init_components;
 wenzelm parents: 
48837diff
changeset | 231 |     while { unset REPLY; read -r; test "$?" = 0 -o -n "$REPLY"; }
 | 
| 
623ba165d059
direct support for component forests via init_components;
 wenzelm parents: 
48837diff
changeset | 232 | do | 
| 
623ba165d059
direct support for component forests via init_components;
 wenzelm parents: 
48837diff
changeset | 233 | case "$REPLY" in | 
| 
623ba165d059
direct support for component forests via init_components;
 wenzelm parents: 
48837diff
changeset | 234 | \#* | "") ;; | 
| 
623ba165d059
direct support for component forests via init_components;
 wenzelm parents: 
48837diff
changeset | 235 | /*) init_component "$REPLY" ;; | 
| 
623ba165d059
direct support for component forests via init_components;
 wenzelm parents: 
48837diff
changeset | 236 | *) init_component "$BASE/$REPLY" ;; | 
| 
623ba165d059
direct support for component forests via init_components;
 wenzelm parents: 
48837diff
changeset | 237 | esac | 
| 
623ba165d059
direct support for component forests via init_components;
 wenzelm parents: 
48837diff
changeset | 238 | done | 
| 
623ba165d059
direct support for component forests via init_components;
 wenzelm parents: 
48837diff
changeset | 239 | } < "$CATALOG" | 
| 32305 
c5523ded51d9
basic support for components (which imitate the usual Isabelle directory layout);
 wenzelm parents: 
31520diff
changeset | 240 | } | 
| 
c5523ded51d9
basic support for components (which imitate the usual Isabelle directory layout);
 wenzelm parents: 
31520diff
changeset | 241 | |
| 
c5523ded51d9
basic support for components (which imitate the usual Isabelle directory layout);
 wenzelm parents: 
31520diff
changeset | 242 | #main components | 
| 
c5523ded51d9
basic support for components (which imitate the usual Isabelle directory layout);
 wenzelm parents: 
31520diff
changeset | 243 | init_component "$ISABELLE_HOME" | 
| 48725 
e852f4d6af80
configure Admin as component, with its own lib/Tools;
 wenzelm parents: 
48551diff
changeset | 244 | [ -d "$ISABELLE_HOME/Admin" ] && init_component "$ISABELLE_HOME/Admin" | 
| 32321 
13920dbe4547
more uniform handling of ISABELLE_HOME_USER component;
 wenzelm parents: 
32305diff
changeset | 245 | [ -d "$ISABELLE_HOME_USER" ] && init_component "$ISABELLE_HOME_USER" | 
| 2299 
ed9720047d53
getsettings: bash source script to augment current env.
 wenzelm parents: diff
changeset | 246 | |
| 48838 
623ba165d059
direct support for component forests via init_components;
 wenzelm parents: 
48837diff
changeset | 247 | |
| 21490 | 248 | #ML system identifier | 
| 6413 | 249 | if [ -z "$ML_PLATFORM" ]; then | 
| 250 | ML_IDENTIFIER="$ML_SYSTEM" | |
| 251 | else | |
| 252 |   ML_IDENTIFIER="${ML_SYSTEM}_${ML_PLATFORM}"
 | |
| 253 | fi | |
| 21468 
c7892915ed10
add ISABELLE_VERSION to ML_IDENTIFIER, unless this is repository or build;
 wenzelm parents: 
16293diff
changeset | 254 | |
| 48838 
623ba165d059
direct support for component forests via init_components;
 wenzelm parents: 
48837diff
changeset | 255 | ISABELLE_OUTPUT="$ISABELLE_OUTPUT/$ML_IDENTIFIER" | 
| 
623ba165d059
direct support for component forests via init_components;
 wenzelm parents: 
48837diff
changeset | 256 | |
| 47748 
24550210de0b
enforce our JAVA_HOME to avoid potential conflicts with other Java installations by the user;
 wenzelm parents: 
47661diff
changeset | 257 | #enforce JAVA_HOME | 
| 
24550210de0b
enforce our JAVA_HOME to avoid potential conflicts with other Java installations by the user;
 wenzelm parents: 
47661diff
changeset | 258 | export JAVA_HOME="$ISABELLE_JDK_HOME" | 
| 
24550210de0b
enforce our JAVA_HOME to avoid potential conflicts with other Java installations by the user;
 wenzelm parents: 
47661diff
changeset | 259 | |
| 48495 | 260 | #build condition etc. | 
| 261 | case "$ML_SYSTEM" in | |
| 262 | polyml*) | |
| 263 | ISABELLE_POLYML="true" | |
| 264 | ;; | |
| 265 | *) | |
| 266 | ISABELLE_POLYML="" | |
| 267 | ;; | |
| 268 | esac | |
| 269 | ||
| 2299 
ed9720047d53
getsettings: bash source script to augment current env.
 wenzelm parents: diff
changeset | 270 | set +o allexport | 
| 7770 
0497323c1f0b
ISABELLE_SETTINGS_PRESENT: avoid multiple invocation;
 wenzelm parents: 
6413diff
changeset | 271 | |
| 
0497323c1f0b
ISABELLE_SETTINGS_PRESENT: avoid multiple invocation;
 wenzelm parents: 
6413diff
changeset | 272 | fi |