author | wenzelm |
Wed, 18 Jul 2012 19:47:10 +0200 | |
changeset 48340 | 6f4fc030882a |
parent 48276 | 4bd480886813 |
child 48425 | 0d95980e9aae |
permissions | -rwxr-xr-x |
48276 | 1 |
#!/usr/bin/env bash |
2 |
# |
|
3 |
# Author: Makarius |
|
4 |
# |
|
5 |
# DESCRIPTION: build and manage Isabelle sessions |
|
6 |
||
7 |
||
8 |
## diagnostics |
|
9 |
||
10 |
PRG="$(basename "$0")" |
|
11 |
||
12 |
function usage() |
|
13 |
{ |
|
14 |
echo |
|
15 |
echo "Usage: isabelle $PRG [OPTIONS] [SESSIONS ...]" |
|
16 |
echo |
|
17 |
echo " Options are:" |
|
18 |
echo " -a all sessions" |
|
19 |
echo " -b build target images" |
|
48340
6f4fc030882a
allow explicit specification of additional session directories;
wenzelm
parents:
48276
diff
changeset
|
20 |
echo " -d DIR additional session directory with ROOT file" |
48276 | 21 |
echo " -l list sessions only" |
22 |
echo " -o OPTION override session configuration OPTION (via NAME=VAL or NAME)" |
|
23 |
echo |
|
24 |
echo " Build and manage Isabelle sessions, depending on implicit" |
|
25 |
echo " ISABELLE_BUILD_OPTIONS=\"$ISABELLE_BUILD_OPTIONS\"" |
|
26 |
echo |
|
27 |
echo " ML_PLATFORM=\"$ML_PLATFORM\"" |
|
28 |
echo " ML_HOME=\"$ML_HOME\"" |
|
29 |
echo " ML_SYSTEM=\"$ML_SYSTEM\"" |
|
30 |
echo " ML_OPTIONS=\"$ML_OPTIONS\"" |
|
31 |
echo |
|
32 |
exit 1 |
|
33 |
} |
|
34 |
||
35 |
function fail() |
|
36 |
{ |
|
37 |
echo "$1" >&2 |
|
38 |
exit 2 |
|
39 |
} |
|
40 |
||
41 |
||
42 |
## process command line |
|
43 |
||
44 |
ALL_SESSIONS=false |
|
45 |
BUILD_IMAGES=false |
|
46 |
LIST_ONLY=false |
|
47 |
||
48340
6f4fc030882a
allow explicit specification of additional session directories;
wenzelm
parents:
48276
diff
changeset
|
48 |
declare -a MORE_DIRS=() |
48276 | 49 |
eval "declare -a BUILD_OPTIONS=($ISABELLE_BUILD_OPTIONS)" |
50 |
||
48340
6f4fc030882a
allow explicit specification of additional session directories;
wenzelm
parents:
48276
diff
changeset
|
51 |
while getopts "abd:lo:" OPT |
48276 | 52 |
do |
53 |
case "$OPT" in |
|
54 |
a) |
|
55 |
ALL_SESSIONS="true" |
|
56 |
;; |
|
57 |
b) |
|
58 |
BUILD_IMAGES="true" |
|
59 |
;; |
|
48340
6f4fc030882a
allow explicit specification of additional session directories;
wenzelm
parents:
48276
diff
changeset
|
60 |
d) |
6f4fc030882a
allow explicit specification of additional session directories;
wenzelm
parents:
48276
diff
changeset
|
61 |
MORE_DIRS["${#MORE_DIRS[@]}"]="$OPTARG" |
6f4fc030882a
allow explicit specification of additional session directories;
wenzelm
parents:
48276
diff
changeset
|
62 |
;; |
48276 | 63 |
l) |
64 |
LIST_ONLY="true" |
|
65 |
;; |
|
66 |
o) |
|
67 |
BUILD_OPTIONS["${#BUILD_OPTIONS[@]}"]="$OPTARG" |
|
68 |
;; |
|
69 |
\?) |
|
70 |
usage |
|
71 |
;; |
|
72 |
esac |
|
73 |
done |
|
74 |
||
75 |
shift $(($OPTIND - 1)) |
|
76 |
||
77 |
||
78 |
## main |
|
79 |
||
80 |
[ -e "$ISABELLE_HOME/Admin/build" ] && { "$ISABELLE_HOME/Admin/build" jars || exit $?; } |
|
81 |
||
82 |
exec "$ISABELLE_TOOL" java isabelle.Build \ |
|
48340
6f4fc030882a
allow explicit specification of additional session directories;
wenzelm
parents:
48276
diff
changeset
|
83 |
"$ALL_SESSIONS" "$BUILD_IMAGES" "$LIST_ONLY" \ |
6f4fc030882a
allow explicit specification of additional session directories;
wenzelm
parents:
48276
diff
changeset
|
84 |
"${MORE_DIRS[@]}" $'\n' "${BUILD_OPTIONS[@]}" $'\n' "$@" |