lib/Tools/options
author wenzelm
Sun, 20 Jan 2013 13:59:13 +0100
changeset 50990 11996ea98bbe
parent 50531 f841ac0cb757
child 52055 10bc73197a57
permissions -rwxr-xr-x
tuned;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
48693
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
     1
#!/usr/bin/env bash
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
     2
#
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
     3
# Author: Makarius
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
     4
#
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
     5
# DESCRIPTION: print Isabelle system options
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
     6
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
     7
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
     8
## diagnostics
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
     9
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    10
PRG="$(basename "$0")"
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    11
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    12
function usage()
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    13
{
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    14
  echo
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    15
  echo "Usage: isabelle $PRG [OPTIONS] [MORE_OPTIONS ...]"
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    16
  echo
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    17
  echo "  Options are:"
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    18
  echo "    -b           include \$ISABELLE_BUILD_OPTIONS"
50531
f841ac0cb757 clarified "isabelle options" command line, to make it more close to "isabelle components";
wenzelm
parents: 48693
diff changeset
    19
  echo "    -l           list options"
f841ac0cb757 clarified "isabelle options" command line, to make it more close to "isabelle components";
wenzelm
parents: 48693
diff changeset
    20
  echo "    -x FILE      export options to FILE in YXML format"
48693
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    21
  echo
50531
f841ac0cb757 clarified "isabelle options" command line, to make it more close to "isabelle components";
wenzelm
parents: 48693
diff changeset
    22
  echo "  Report Isabelle system options, augmented by MORE_OPTIONS given as"
48693
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    23
  echo "  arguments NAME=VAL or NAME."
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    24
  echo
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    25
  exit 1
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    26
}
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    27
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    28
function fail()
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    29
{
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    30
  echo "$1" >&2
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    31
  exit 2
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    32
}
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    33
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    34
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    35
## process command line
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    36
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    37
eval "declare -a BUILD_OPTIONS=()"
50531
f841ac0cb757 clarified "isabelle options" command line, to make it more close to "isabelle components";
wenzelm
parents: 48693
diff changeset
    38
LIST_OPTIONS="false"
48693
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    39
EXPORT_FILE=""
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    40
50531
f841ac0cb757 clarified "isabelle options" command line, to make it more close to "isabelle components";
wenzelm
parents: 48693
diff changeset
    41
while getopts "blx:" OPT
48693
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    42
do
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    43
  case "$OPT" in
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    44
    b)
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    45
      BUILD_OPTIONS=($ISABELLE_BUILD_OPTIONS)
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    46
      ;;
50531
f841ac0cb757 clarified "isabelle options" command line, to make it more close to "isabelle components";
wenzelm
parents: 48693
diff changeset
    47
    l)
f841ac0cb757 clarified "isabelle options" command line, to make it more close to "isabelle components";
wenzelm
parents: 48693
diff changeset
    48
      LIST_OPTIONS="true"
f841ac0cb757 clarified "isabelle options" command line, to make it more close to "isabelle components";
wenzelm
parents: 48693
diff changeset
    49
      ;;
48693
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    50
    x)
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    51
      EXPORT_FILE="$OPTARG"
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    52
      ;;
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    53
    \?)
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    54
      usage
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    55
      ;;
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    56
  esac
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    57
done
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    58
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    59
shift $(($OPTIND - 1))
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    60
50531
f841ac0cb757 clarified "isabelle options" command line, to make it more close to "isabelle components";
wenzelm
parents: 48693
diff changeset
    61
[ "$LIST_OPTIONS" = "false" -a -z "$EXPORT_FILE" ] && usage
f841ac0cb757 clarified "isabelle options" command line, to make it more close to "isabelle components";
wenzelm
parents: 48693
diff changeset
    62
48693
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    63
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    64
## main
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    65
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    66
[ -e "$ISABELLE_HOME/Admin/build" ] && { "$ISABELLE_HOME/Admin/build" jars || exit $?; }
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    67
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    68
exec "$ISABELLE_TOOL" java isabelle.Options "$EXPORT_FILE" "${BUILD_OPTIONS[@]}" "$@"
ceeea46bdeba "isabelle options" prints Isabelle system options;
wenzelm
parents:
diff changeset
    69