equal
deleted
inserted
replaced
|
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" |
|
20 echo " -l list sessions only" |
|
21 echo " -o OPTION override session configuration OPTION (via NAME=VAL or NAME)" |
|
22 echo |
|
23 echo " Build and manage Isabelle sessions, depending on implicit" |
|
24 echo " ISABELLE_BUILD_OPTIONS=\"$ISABELLE_BUILD_OPTIONS\"" |
|
25 echo |
|
26 echo " ML_PLATFORM=\"$ML_PLATFORM\"" |
|
27 echo " ML_HOME=\"$ML_HOME\"" |
|
28 echo " ML_SYSTEM=\"$ML_SYSTEM\"" |
|
29 echo " ML_OPTIONS=\"$ML_OPTIONS\"" |
|
30 echo |
|
31 exit 1 |
|
32 } |
|
33 |
|
34 function fail() |
|
35 { |
|
36 echo "$1" >&2 |
|
37 exit 2 |
|
38 } |
|
39 |
|
40 |
|
41 ## process command line |
|
42 |
|
43 ALL_SESSIONS=false |
|
44 BUILD_IMAGES=false |
|
45 LIST_ONLY=false |
|
46 |
|
47 eval "declare -a BUILD_OPTIONS=($ISABELLE_BUILD_OPTIONS)" |
|
48 |
|
49 while getopts "ablo:" OPT |
|
50 do |
|
51 case "$OPT" in |
|
52 a) |
|
53 ALL_SESSIONS="true" |
|
54 ;; |
|
55 b) |
|
56 BUILD_IMAGES="true" |
|
57 ;; |
|
58 l) |
|
59 LIST_ONLY="true" |
|
60 ;; |
|
61 o) |
|
62 BUILD_OPTIONS["${#BUILD_OPTIONS[@]}"]="$OPTARG" |
|
63 ;; |
|
64 \?) |
|
65 usage |
|
66 ;; |
|
67 esac |
|
68 done |
|
69 |
|
70 shift $(($OPTIND - 1)) |
|
71 |
|
72 |
|
73 ## main |
|
74 |
|
75 [ -e "$ISABELLE_HOME/Admin/build" ] && { "$ISABELLE_HOME/Admin/build" jars || exit $?; } |
|
76 |
|
77 exec "$ISABELLE_TOOL" java isabelle.Build \ |
|
78 "$ALL_SESSIONS" "$BUILD_IMAGES" "$LIST_ONLY" "${BUILD_OPTIONS[@]}" $'\n' "$@" |