| author | wenzelm | 
| Wed, 14 Aug 2024 13:51:36 +0200 | |
| changeset 80705 | 552cdee5cd43 | 
| parent 79556 | 0631dfc0db07 | 
| permissions | -rw-r--r-- | 
| 62412 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 1 | # -*- shell-script -*- :mode=shellscript: | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 2 | # | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 3 | # Author: Makarius | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 4 | # | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 5 | # Isabelle shell functions, with on-demand re-initialization for | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 6 | # non-interactive bash processess. NB: bash shell functions are not portable | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 7 | # and may be dropped by aggressively POSIX-conformant versions of /bin/sh. | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 8 | |
| 73773 
ac7f41b66e1b
further "unset CDPATH", whenever a new non-interactive bash is started (see also ac07f6be27ea);
 wenzelm parents: 
73580diff
changeset | 9 | unset CDPATH | 
| 
ac7f41b66e1b
further "unset CDPATH", whenever a new non-interactive bash is started (see also ac07f6be27ea);
 wenzelm parents: 
73580diff
changeset | 10 | |
| 62416 | 11 | if type splitarray >/dev/null 2>/dev/null | 
| 62412 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 12 | then | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 13 | : | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 14 | else | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 15 | |
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 16 | if [ "$OSTYPE" = cygwin ]; then | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 17 |   function platform_path() { cygpath -i -C UTF8 -w -p "$@"; }
 | 
| 69157 | 18 |   function standard_path() { cygpath -i -u -p "$@" | tr -d '\r'; }
 | 
| 62412 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 19 | else | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 20 |   function platform_path() { echo "$@"; }
 | 
| 69157 | 21 |   function standard_path() { echo "$@"; }
 | 
| 62412 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 22 | fi | 
| 69157 | 23 | export -f platform_path standard_path | 
| 62412 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 24 | |
| 72894 
bd2269b6cd99
updated "macOS" terminology: current Big Sur is already version 11;
 wenzelm parents: 
72465diff
changeset | 25 | #GNU tar (notably on macOS) | 
| 73580 | 26 | function tar() {
 | 
| 27 | if [ -f "$ISABELLE_TAR" ]; then | |
| 28 | "$ISABELLE_TAR" "$@" | |
| 29 | else | |
| 30 | "$(type -P tar)" "$@" | |
| 31 | fi | |
| 32 | } | |
| 73579 | 33 | export -f tar | 
| 62412 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 34 | |
| 78939 | 35 | #registry | 
| 36 | function isabelle_registry () | |
| 37 | {
 | |
| 38 | local X="" | |
| 39 | for X in "$@" | |
| 40 | do | |
| 41 | if [ -z "$ISABELLE_REGISTRY" ]; then | |
| 42 | ISABELLE_REGISTRY="$X" | |
| 43 | elif [ -n "$X" ]; then | |
| 44 | ISABELLE_REGISTRY="$ISABELLE_REGISTRY:$X" | |
| 45 | fi | |
| 46 | done | |
| 47 | export ISABELLE_REGISTRY | |
| 48 | } | |
| 49 | export -f isabelle_registry | |
| 50 | ||
| 69134 | 51 | #OCaml management via OPAM | 
| 73500 | 52 | function isabelle_opam () | 
| 69134 | 53 | {
 | 
| 54 | if [ -z "$ISABELLE_OPAM" ]; then | |
| 55 | echo "Unknown ISABELLE_OPAM -- OCaml management tools unavailable" >&2 | |
| 56 | return 127 | |
| 57 | else | |
| 72465 | 58 | env OPAMROOT="$ISABELLE_OPAM_ROOT" OPAMCOLOR="never" "$ISABELLE_OPAM" "$@" | 
| 69134 | 59 | fi | 
| 60 | } | |
| 61 | export -f isabelle_opam | |
| 62 | ||
| 69150 | 63 | #GHC management via Stack | 
| 73500 | 64 | function isabelle_stack () | 
| 69147 | 65 | {
 | 
| 66 | if [ -z "$ISABELLE_STACK" ]; then | |
| 69150 | 67 | echo "Unknown ISABELLE_STACK -- GHC management tools unavailable" >&2 | 
| 69147 | 68 | return 127 | 
| 69 | else | |
| 69267 
517655a528fe
always insist in specified resolver/compiler version;
 wenzelm parents: 
69255diff
changeset | 70 | env STACK_ROOT="$(platform_path "$ISABELLE_STACK_ROOT")" "$ISABELLE_STACK" --resolver "$ISABELLE_STACK_RESOLVER" --compiler "$ISABELLE_GHC_VERSION" "$@" | 
| 69147 | 71 | fi | 
| 72 | } | |
| 73 | export -f isabelle_stack | |
| 74 | ||
| 62412 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 75 | #robust invocation via ISABELLE_JDK_HOME | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 76 | function isabelle_jdk () | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 77 | {
 | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 78 | if [ -z "$ISABELLE_JDK_HOME" ]; then | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 79 | echo "Unknown ISABELLE_JDK_HOME -- Java development tools unavailable" >&2 | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 80 | return 127 | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 81 | else | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 82 | local PRG="$1"; shift | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 83 | "$ISABELLE_JDK_HOME/bin/$PRG" "$@" | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 84 | fi | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 85 | } | 
| 62413 | 86 | export -f isabelle_jdk | 
| 62412 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 87 | |
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 88 | #robust invocation via JAVA_HOME | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 89 | function isabelle_java () | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 90 | {
 | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 91 | if [ -z "$JAVA_HOME" ]; then | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 92 | echo "Unknown JAVA_HOME -- Java unavailable" >&2 | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 93 | return 127 | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 94 | else | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 95 | local PRG="$1"; shift | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 96 | "$JAVA_HOME/bin/$PRG" "$@" | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 97 | fi | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 98 | } | 
| 62413 | 99 | export -f isabelle_java | 
| 62412 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 100 | |
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 101 | #robust invocation via SCALA_HOME | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 102 | function isabelle_scala () | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 103 | {
 | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 104 | if [ -z "$JAVA_HOME" ]; then | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 105 | echo "Unknown JAVA_HOME -- Java unavailable" >&2 | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 106 | return 127 | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 107 | elif [ -z "$SCALA_HOME" ]; then | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 108 | echo "Unknown SCALA_HOME -- Scala unavailable" >&2 | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 109 | return 127 | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 110 | else | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 111 | local PRG="$1"; shift | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 112 | "$SCALA_HOME/bin/$PRG" "$@" | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 113 | fi | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 114 | } | 
| 62413 | 115 | export -f isabelle_scala | 
| 62412 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 116 | |
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 117 | #classpath | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 118 | function classpath () | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 119 | {
 | 
| 66667 
2e580fcf6522
avoid local shell variables intruding the resulting environment (via "set -o allexport" in getsettings);
 wenzelm parents: 
63994diff
changeset | 120 | local X="" | 
| 62412 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 121 | for X in "$@" | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 122 | do | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 123 | if [ -z "$ISABELLE_CLASSPATH" ]; then | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 124 | ISABELLE_CLASSPATH="$X" | 
| 73989 | 125 | elif [ -n "$X" ]; then | 
| 62412 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 126 | ISABELLE_CLASSPATH="$ISABELLE_CLASSPATH:$X" | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 127 | fi | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 128 | done | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 129 | export ISABELLE_CLASSPATH | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 130 | } | 
| 62413 | 131 | export -f classpath | 
| 62412 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 132 | |
| 73513 
b7bb665fe850
more systematic java_library: avoid empty entries, declaration order as for other bash functions;
 wenzelm parents: 
73500diff
changeset | 133 | #java_library | 
| 
b7bb665fe850
more systematic java_library: avoid empty entries, declaration order as for other bash functions;
 wenzelm parents: 
73500diff
changeset | 134 | function java_library () | 
| 
b7bb665fe850
more systematic java_library: avoid empty entries, declaration order as for other bash functions;
 wenzelm parents: 
73500diff
changeset | 135 | {
 | 
| 
b7bb665fe850
more systematic java_library: avoid empty entries, declaration order as for other bash functions;
 wenzelm parents: 
73500diff
changeset | 136 | local X="" | 
| 
b7bb665fe850
more systematic java_library: avoid empty entries, declaration order as for other bash functions;
 wenzelm parents: 
73500diff
changeset | 137 | for X in "$@" | 
| 
b7bb665fe850
more systematic java_library: avoid empty entries, declaration order as for other bash functions;
 wenzelm parents: 
73500diff
changeset | 138 | do | 
| 
b7bb665fe850
more systematic java_library: avoid empty entries, declaration order as for other bash functions;
 wenzelm parents: 
73500diff
changeset | 139 | case "$ISABELLE_PLATFORM_FAMILY" in | 
| 79556 
0631dfc0db07
more robust check of ISABELLE_PLATFORM_FAMILY within settings environment, to support its reunification with Isabelle/Scala (see also a33a6e541cbb, f3a356c64193);
 wenzelm parents: 
78939diff
changeset | 140 | linux*) | 
| 73513 
b7bb665fe850
more systematic java_library: avoid empty entries, declaration order as for other bash functions;
 wenzelm parents: 
73500diff
changeset | 141 | if [ -z "$LD_LIBRARY_PATH" ]; then | 
| 
b7bb665fe850
more systematic java_library: avoid empty entries, declaration order as for other bash functions;
 wenzelm parents: 
73500diff
changeset | 142 | export LD_LIBRARY_PATH="$X" | 
| 
b7bb665fe850
more systematic java_library: avoid empty entries, declaration order as for other bash functions;
 wenzelm parents: 
73500diff
changeset | 143 | else | 
| 
b7bb665fe850
more systematic java_library: avoid empty entries, declaration order as for other bash functions;
 wenzelm parents: 
73500diff
changeset | 144 | export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$X" | 
| 
b7bb665fe850
more systematic java_library: avoid empty entries, declaration order as for other bash functions;
 wenzelm parents: 
73500diff
changeset | 145 | fi | 
| 
b7bb665fe850
more systematic java_library: avoid empty entries, declaration order as for other bash functions;
 wenzelm parents: 
73500diff
changeset | 146 | ;; | 
| 79556 
0631dfc0db07
more robust check of ISABELLE_PLATFORM_FAMILY within settings environment, to support its reunification with Isabelle/Scala (see also a33a6e541cbb, f3a356c64193);
 wenzelm parents: 
78939diff
changeset | 147 | macos*) | 
| 73513 
b7bb665fe850
more systematic java_library: avoid empty entries, declaration order as for other bash functions;
 wenzelm parents: 
73500diff
changeset | 148 | if [ -z "$JAVA_LIBRARY_PATH" ]; then | 
| 
b7bb665fe850
more systematic java_library: avoid empty entries, declaration order as for other bash functions;
 wenzelm parents: 
73500diff
changeset | 149 | export JAVA_LIBRARY_PATH="$X" | 
| 
b7bb665fe850
more systematic java_library: avoid empty entries, declaration order as for other bash functions;
 wenzelm parents: 
73500diff
changeset | 150 | else | 
| 
b7bb665fe850
more systematic java_library: avoid empty entries, declaration order as for other bash functions;
 wenzelm parents: 
73500diff
changeset | 151 | export JAVA_LIBRARY_PATH="$JAVA_LIBRARY_PATH:$X" | 
| 
b7bb665fe850
more systematic java_library: avoid empty entries, declaration order as for other bash functions;
 wenzelm parents: 
73500diff
changeset | 152 | fi | 
| 
b7bb665fe850
more systematic java_library: avoid empty entries, declaration order as for other bash functions;
 wenzelm parents: 
73500diff
changeset | 153 | ;; | 
| 79556 
0631dfc0db07
more robust check of ISABELLE_PLATFORM_FAMILY within settings environment, to support its reunification with Isabelle/Scala (see also a33a6e541cbb, f3a356c64193);
 wenzelm parents: 
78939diff
changeset | 154 | windows*) | 
| 73513 
b7bb665fe850
more systematic java_library: avoid empty entries, declaration order as for other bash functions;
 wenzelm parents: 
73500diff
changeset | 155 | if [ -z "$PATH" ]; then | 
| 
b7bb665fe850
more systematic java_library: avoid empty entries, declaration order as for other bash functions;
 wenzelm parents: 
73500diff
changeset | 156 | export PATH="$X" | 
| 
b7bb665fe850
more systematic java_library: avoid empty entries, declaration order as for other bash functions;
 wenzelm parents: 
73500diff
changeset | 157 | else | 
| 
b7bb665fe850
more systematic java_library: avoid empty entries, declaration order as for other bash functions;
 wenzelm parents: 
73500diff
changeset | 158 | export PATH="$PATH:$X" | 
| 
b7bb665fe850
more systematic java_library: avoid empty entries, declaration order as for other bash functions;
 wenzelm parents: 
73500diff
changeset | 159 | fi | 
| 
b7bb665fe850
more systematic java_library: avoid empty entries, declaration order as for other bash functions;
 wenzelm parents: 
73500diff
changeset | 160 | ;; | 
| 
b7bb665fe850
more systematic java_library: avoid empty entries, declaration order as for other bash functions;
 wenzelm parents: 
73500diff
changeset | 161 | esac | 
| 
b7bb665fe850
more systematic java_library: avoid empty entries, declaration order as for other bash functions;
 wenzelm parents: 
73500diff
changeset | 162 | done | 
| 
b7bb665fe850
more systematic java_library: avoid empty entries, declaration order as for other bash functions;
 wenzelm parents: 
73500diff
changeset | 163 | export ISABELLE_CLASSPATH | 
| 
b7bb665fe850
more systematic java_library: avoid empty entries, declaration order as for other bash functions;
 wenzelm parents: 
73500diff
changeset | 164 | } | 
| 
b7bb665fe850
more systematic java_library: avoid empty entries, declaration order as for other bash functions;
 wenzelm parents: 
73500diff
changeset | 165 | export -f java_library | 
| 
b7bb665fe850
more systematic java_library: avoid empty entries, declaration order as for other bash functions;
 wenzelm parents: 
73500diff
changeset | 166 | |
| 69342 | 167 | #Isabelle fonts | 
| 168 | function isabelle_fonts () | |
| 169 | {
 | |
| 170 | local X="" | |
| 171 | for X in "$@" | |
| 172 | do | |
| 173 | if [ -z "$ISABELLE_FONTS" ]; then | |
| 174 | ISABELLE_FONTS="$X" | |
| 175 | else | |
| 176 | ISABELLE_FONTS="$ISABELLE_FONTS:$X" | |
| 177 | fi | |
| 178 | done | |
| 179 | export ISABELLE_FONTS | |
| 180 | } | |
| 181 | export -f isabelle_fonts | |
| 182 | ||
| 69374 | 183 | function isabelle_fonts_hidden () | 
| 184 | {
 | |
| 185 | local X="" | |
| 186 | for X in "$@" | |
| 187 | do | |
| 188 | if [ -z "$ISABELLE_FONTS_HIDDEN" ]; then | |
| 189 | ISABELLE_FONTS_HIDDEN="$X" | |
| 190 | else | |
| 191 | ISABELLE_FONTS_HIDDEN="$ISABELLE_FONTS_HIDDEN:$X" | |
| 192 | fi | |
| 193 | done | |
| 194 | export ISABELLE_FONTS_HIDDEN | |
| 195 | } | |
| 196 | export -f isabelle_fonts_hidden | |
| 197 | ||
| 71733 | 198 | #Isabelle/Scala services | 
| 199 | function isabelle_scala_service () | |
| 69255 
800b1ce96fce
more general support for Isabelle/PIDE file formats -- less hardwired Bibtex operations;
 wenzelm parents: 
69157diff
changeset | 200 | {
 | 
| 
800b1ce96fce
more general support for Isabelle/PIDE file formats -- less hardwired Bibtex operations;
 wenzelm parents: 
69157diff
changeset | 201 | local X="" | 
| 
800b1ce96fce
more general support for Isabelle/PIDE file formats -- less hardwired Bibtex operations;
 wenzelm parents: 
69157diff
changeset | 202 | for X in "$@" | 
| 
800b1ce96fce
more general support for Isabelle/PIDE file formats -- less hardwired Bibtex operations;
 wenzelm parents: 
69157diff
changeset | 203 | do | 
| 71733 | 204 | if [ -z "$ISABELLE_SCALA_SERVICES" ]; then | 
| 205 | ISABELLE_SCALA_SERVICES="$X" | |
| 69255 
800b1ce96fce
more general support for Isabelle/PIDE file formats -- less hardwired Bibtex operations;
 wenzelm parents: 
69157diff
changeset | 206 | else | 
| 71733 | 207 | ISABELLE_SCALA_SERVICES="$ISABELLE_SCALA_SERVICES:$X" | 
| 69255 
800b1ce96fce
more general support for Isabelle/PIDE file formats -- less hardwired Bibtex operations;
 wenzelm parents: 
69157diff
changeset | 208 | fi | 
| 
800b1ce96fce
more general support for Isabelle/PIDE file formats -- less hardwired Bibtex operations;
 wenzelm parents: 
69157diff
changeset | 209 | done | 
| 71733 | 210 | export ISABELLE_SCALA_SERVICES | 
| 69255 
800b1ce96fce
more general support for Isabelle/PIDE file formats -- less hardwired Bibtex operations;
 wenzelm parents: 
69157diff
changeset | 211 | } | 
| 71733 | 212 | export -f isabelle_scala_service | 
| 69255 
800b1ce96fce
more general support for Isabelle/PIDE file formats -- less hardwired Bibtex operations;
 wenzelm parents: 
69157diff
changeset | 213 | |
| 72162 | 214 | #Special directories | 
| 215 | function isabelle_directory () | |
| 216 | {
 | |
| 217 | local X="" | |
| 218 | for X in "$@" | |
| 219 | do | |
| 220 | if [ -z "$ISABELLE_DIRECTORIES" ]; then | |
| 221 | ISABELLE_DIRECTORIES="$X" | |
| 222 | else | |
| 223 | ISABELLE_DIRECTORIES="$ISABELLE_DIRECTORIES:$X" | |
| 224 | fi | |
| 225 | done | |
| 226 | export ISABELLE_DIRECTORIES | |
| 227 | } | |
| 228 | export -f isabelle_directory | |
| 229 | ||
| 62412 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 230 | #arrays | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 231 | function splitarray () | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 232 | {
 | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 233 | SPLITARRAY=() | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 234 | local IFS="$1"; shift | 
| 66667 
2e580fcf6522
avoid local shell variables intruding the resulting environment (via "set -o allexport" in getsettings);
 wenzelm parents: 
63994diff
changeset | 235 | local X="" | 
| 62412 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 236 | for X in $* | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 237 | do | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 238 |     SPLITARRAY["${#SPLITARRAY[@]}"]="$X"
 | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 239 | done | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 240 | } | 
| 62413 | 241 | export -f splitarray | 
| 62412 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 242 | |
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 243 | #init component tree | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 244 | function init_component () | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 245 | {
 | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 246 | local COMPONENT="$1" | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 247 | case "$COMPONENT" in | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 248 | /*) ;; | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 249 | *) | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 250 | echo >&2 "Absolute component path required: \"$COMPONENT\"" | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 251 | exit 2 | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 252 | ;; | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 253 | esac | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 254 | |
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 255 | if [ -d "$COMPONENT" ]; then | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 256 | if [ -z "$ISABELLE_COMPONENTS" ]; then | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 257 | ISABELLE_COMPONENTS="$COMPONENT" | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 258 | else | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 259 | ISABELLE_COMPONENTS="$ISABELLE_COMPONENTS:$COMPONENT" | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 260 | fi | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 261 | else | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 262 | echo >&2 "### Missing Isabelle component: \"$COMPONENT\"" | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 263 | if [ -z "$ISABELLE_COMPONENTS_MISSING" ]; then | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 264 | ISABELLE_COMPONENTS_MISSING="$COMPONENT" | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 265 | else | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 266 | ISABELLE_COMPONENTS_MISSING="$ISABELLE_COMPONENTS_MISSING:$COMPONENT" | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 267 | fi | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 268 | fi | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 269 | |
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 270 | if [ -f "$COMPONENT/etc/settings" ]; then | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 271 | source "$COMPONENT/etc/settings" | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 272 | local RC="$?" | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 273 | if [ "$RC" -ne 0 ]; then | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 274 | echo >&2 "Return code $RC from bash script: \"$COMPONENT/etc/settings\"" | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 275 | exit 2 | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 276 | fi | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 277 | fi | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 278 | if [ -f "$COMPONENT/etc/components" ]; then | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 279 | init_components "$COMPONENT" "$COMPONENT/etc/components" | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 280 | fi | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 281 | } | 
| 62413 | 282 | export -f init_component | 
| 62412 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 283 | |
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 284 | #init component forest | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 285 | function init_components () | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 286 | {
 | 
| 66667 
2e580fcf6522
avoid local shell variables intruding the resulting environment (via "set -o allexport" in getsettings);
 wenzelm parents: 
63994diff
changeset | 287 | local REPLY="" | 
| 62412 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 288 | local BASE="$1" | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 289 | local CATALOG="$2" | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 290 | local COMPONENT="" | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 291 | local -a COMPONENTS=() | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 292 | |
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 293 | if [ ! -f "$CATALOG" ]; then | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 294 | echo >&2 "Bad component catalog file: \"$CATALOG\"" | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 295 | exit 2 | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 296 | fi | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 297 | |
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 298 |   {
 | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 299 |     while { unset REPLY; read -r; test "$?" = 0 -o -n "$REPLY"; }
 | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 300 | do | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 301 | case "$REPLY" in | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 302 | \#* | "") ;; | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 303 |         /*) COMPONENTS["${#COMPONENTS[@]}"]="$REPLY" ;;
 | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 304 |         *) COMPONENTS["${#COMPONENTS[@]}"]="$BASE/$REPLY" ;;
 | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 305 | esac | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 306 | done | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 307 | } < "$CATALOG" | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 308 | |
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 309 |   for COMPONENT in "${COMPONENTS[@]}"
 | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 310 | do | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 311 | init_component "$COMPONENT" | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 312 | done | 
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 313 | } | 
| 62413 | 314 | export -f init_components | 
| 62412 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 315 | |
| 
ffdc5cf36dc5
more robust treatment of shell functions: dynamic_env recreates lost definitions on demand, e.g. after going through aggressive versions of /bin/sh -> dash;
 wenzelm parents: diff
changeset | 316 | fi |